All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.iam.kotlin.AccountPasswordPolicy.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.iam.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [AccountPasswordPolicy].
 */
@PulumiTagMarker
public class AccountPasswordPolicyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AccountPasswordPolicyArgs = AccountPasswordPolicyArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend AccountPasswordPolicyArgsBuilder.() -> Unit) {
        val builder = AccountPasswordPolicyArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): AccountPasswordPolicy {
        val builtJavaResource = com.pulumi.aws.iam.AccountPasswordPolicy(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return AccountPasswordPolicy(builtJavaResource)
    }
}

/**
 * > **Note:** There is only a single policy allowed per AWS account. An existing policy will be lost when using this resource as an effect of this limitation.
 * Manages Password Policy for the AWS Account.
 * See more about [Account Password Policy](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_account-policy.html)
 * in the official AWS docs.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const strict = new aws.iam.AccountPasswordPolicy("strict", {
 *     minimumPasswordLength: 8,
 *     requireLowercaseCharacters: true,
 *     requireNumbers: true,
 *     requireUppercaseCharacters: true,
 *     requireSymbols: true,
 *     allowUsersToChangePassword: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * strict = aws.iam.AccountPasswordPolicy("strict",
 *     minimum_password_length=8,
 *     require_lowercase_characters=True,
 *     require_numbers=True,
 *     require_uppercase_characters=True,
 *     require_symbols=True,
 *     allow_users_to_change_password=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var strict = new Aws.Iam.AccountPasswordPolicy("strict", new()
 *     {
 *         MinimumPasswordLength = 8,
 *         RequireLowercaseCharacters = true,
 *         RequireNumbers = true,
 *         RequireUppercaseCharacters = true,
 *         RequireSymbols = true,
 *         AllowUsersToChangePassword = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := iam.NewAccountPasswordPolicy(ctx, "strict", &iam.AccountPasswordPolicyArgs{
 * 			MinimumPasswordLength:      pulumi.Int(8),
 * 			RequireLowercaseCharacters: pulumi.Bool(true),
 * 			RequireNumbers:             pulumi.Bool(true),
 * 			RequireUppercaseCharacters: pulumi.Bool(true),
 * 			RequireSymbols:             pulumi.Bool(true),
 * 			AllowUsersToChangePassword: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.iam.AccountPasswordPolicy;
 * import com.pulumi.aws.iam.AccountPasswordPolicyArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var strict = new AccountPasswordPolicy("strict", AccountPasswordPolicyArgs.builder()
 *             .minimumPasswordLength(8)
 *             .requireLowercaseCharacters(true)
 *             .requireNumbers(true)
 *             .requireUppercaseCharacters(true)
 *             .requireSymbols(true)
 *             .allowUsersToChangePassword(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   strict:
 *     type: aws:iam:AccountPasswordPolicy
 *     properties:
 *       minimumPasswordLength: 8
 *       requireLowercaseCharacters: true
 *       requireNumbers: true
 *       requireUppercaseCharacters: true
 *       requireSymbols: true
 *       allowUsersToChangePassword: true
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import IAM Account Password Policy using the word `iam-account-password-policy`. For example:
 * ```sh
 * $ pulumi import aws:iam/accountPasswordPolicy:AccountPasswordPolicy strict iam-account-password-policy
 * ```
 */
public class AccountPasswordPolicy internal constructor(
    override val javaResource: com.pulumi.aws.iam.AccountPasswordPolicy,
) : KotlinCustomResource(javaResource, AccountPasswordPolicyMapper) {
    /**
     * Whether to allow users to change their own password
     */
    public val allowUsersToChangePassword: Output?
        get() = javaResource.allowUsersToChangePassword().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Indicates whether passwords in the account expire. Returns `true` if `max_password_age` contains a value greater than `0`. Returns `false` if it is `0` or _not present_.
     */
    public val expirePasswords: Output
        get() = javaResource.expirePasswords().applyValue({ args0 -> args0 })

    /**
     * Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
     */
    public val hardExpiry: Output
        get() = javaResource.hardExpiry().applyValue({ args0 -> args0 })

    /**
     * The number of days that an user password is valid.
     */
    public val maxPasswordAge: Output
        get() = javaResource.maxPasswordAge().applyValue({ args0 -> args0 })

    /**
     * Minimum length to require for user passwords.
     */
    public val minimumPasswordLength: Output?
        get() = javaResource.minimumPasswordLength().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The number of previous passwords that users are prevented from reusing.
     */
    public val passwordReusePrevention: Output
        get() = javaResource.passwordReusePrevention().applyValue({ args0 -> args0 })

    /**
     * Whether to require lowercase characters for user passwords.
     */
    public val requireLowercaseCharacters: Output
        get() = javaResource.requireLowercaseCharacters().applyValue({ args0 -> args0 })

    /**
     * Whether to require numbers for user passwords.
     */
    public val requireNumbers: Output
        get() = javaResource.requireNumbers().applyValue({ args0 -> args0 })

    /**
     * Whether to require symbols for user passwords.
     */
    public val requireSymbols: Output
        get() = javaResource.requireSymbols().applyValue({ args0 -> args0 })

    /**
     * Whether to require uppercase characters for user passwords.
     */
    public val requireUppercaseCharacters: Output
        get() = javaResource.requireUppercaseCharacters().applyValue({ args0 -> args0 })
}

public object AccountPasswordPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.iam.AccountPasswordPolicy::class == javaResource::class

    override fun map(javaResource: Resource): AccountPasswordPolicy =
        AccountPasswordPolicy(javaResource as com.pulumi.aws.iam.AccountPasswordPolicy)
}

/**
 * @see [AccountPasswordPolicy].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [AccountPasswordPolicy].
 */
public suspend fun accountPasswordPolicy(
    name: String,
    block: suspend AccountPasswordPolicyResourceBuilder.() -> Unit,
): AccountPasswordPolicy {
    val builder = AccountPasswordPolicyResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [AccountPasswordPolicy].
 * @param name The _unique_ name of the resulting resource.
 */
public fun accountPasswordPolicy(name: String): AccountPasswordPolicy {
    val builder = AccountPasswordPolicyResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy