aws.iam.AccountPasswordPolicy
Explore with Pulumi AI
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 in the official AWS docs.
Example Usage
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,
});
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)
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
	})
}
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,
    });
});
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());
    }
}
resources:
  strict:
    type: aws:iam:AccountPasswordPolicy
    properties:
      minimumPasswordLength: 8
      requireLowercaseCharacters: true
      requireNumbers: true
      requireUppercaseCharacters: true
      requireSymbols: true
      allowUsersToChangePassword: true
Create AccountPasswordPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AccountPasswordPolicy(name: string, args?: AccountPasswordPolicyArgs, opts?: CustomResourceOptions);@overload
def AccountPasswordPolicy(resource_name: str,
                          args: Optional[AccountPasswordPolicyArgs] = None,
                          opts: Optional[ResourceOptions] = None)
@overload
def AccountPasswordPolicy(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          allow_users_to_change_password: Optional[bool] = None,
                          hard_expiry: Optional[bool] = None,
                          max_password_age: Optional[int] = None,
                          minimum_password_length: Optional[int] = None,
                          password_reuse_prevention: Optional[int] = None,
                          require_lowercase_characters: Optional[bool] = None,
                          require_numbers: Optional[bool] = None,
                          require_symbols: Optional[bool] = None,
                          require_uppercase_characters: Optional[bool] = None)func NewAccountPasswordPolicy(ctx *Context, name string, args *AccountPasswordPolicyArgs, opts ...ResourceOption) (*AccountPasswordPolicy, error)public AccountPasswordPolicy(string name, AccountPasswordPolicyArgs? args = null, CustomResourceOptions? opts = null)
public AccountPasswordPolicy(String name, AccountPasswordPolicyArgs args)
public AccountPasswordPolicy(String name, AccountPasswordPolicyArgs args, CustomResourceOptions options)
type: aws:iam:AccountPasswordPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args AccountPasswordPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AccountPasswordPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AccountPasswordPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AccountPasswordPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AccountPasswordPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var accountPasswordPolicyResource = new Aws.Iam.AccountPasswordPolicy("accountPasswordPolicyResource", new()
{
    AllowUsersToChangePassword = false,
    HardExpiry = false,
    MaxPasswordAge = 0,
    MinimumPasswordLength = 0,
    PasswordReusePrevention = 0,
    RequireLowercaseCharacters = false,
    RequireNumbers = false,
    RequireSymbols = false,
    RequireUppercaseCharacters = false,
});
example, err := iam.NewAccountPasswordPolicy(ctx, "accountPasswordPolicyResource", &iam.AccountPasswordPolicyArgs{
	AllowUsersToChangePassword: pulumi.Bool(false),
	HardExpiry:                 pulumi.Bool(false),
	MaxPasswordAge:             pulumi.Int(0),
	MinimumPasswordLength:      pulumi.Int(0),
	PasswordReusePrevention:    pulumi.Int(0),
	RequireLowercaseCharacters: pulumi.Bool(false),
	RequireNumbers:             pulumi.Bool(false),
	RequireSymbols:             pulumi.Bool(false),
	RequireUppercaseCharacters: pulumi.Bool(false),
})
var accountPasswordPolicyResource = new AccountPasswordPolicy("accountPasswordPolicyResource", AccountPasswordPolicyArgs.builder()
    .allowUsersToChangePassword(false)
    .hardExpiry(false)
    .maxPasswordAge(0)
    .minimumPasswordLength(0)
    .passwordReusePrevention(0)
    .requireLowercaseCharacters(false)
    .requireNumbers(false)
    .requireSymbols(false)
    .requireUppercaseCharacters(false)
    .build());
account_password_policy_resource = aws.iam.AccountPasswordPolicy("accountPasswordPolicyResource",
    allow_users_to_change_password=False,
    hard_expiry=False,
    max_password_age=0,
    minimum_password_length=0,
    password_reuse_prevention=0,
    require_lowercase_characters=False,
    require_numbers=False,
    require_symbols=False,
    require_uppercase_characters=False)
const accountPasswordPolicyResource = new aws.iam.AccountPasswordPolicy("accountPasswordPolicyResource", {
    allowUsersToChangePassword: false,
    hardExpiry: false,
    maxPasswordAge: 0,
    minimumPasswordLength: 0,
    passwordReusePrevention: 0,
    requireLowercaseCharacters: false,
    requireNumbers: false,
    requireSymbols: false,
    requireUppercaseCharacters: false,
});
type: aws:iam:AccountPasswordPolicy
properties:
    allowUsersToChangePassword: false
    hardExpiry: false
    maxPasswordAge: 0
    minimumPasswordLength: 0
    passwordReusePrevention: 0
    requireLowercaseCharacters: false
    requireNumbers: false
    requireSymbols: false
    requireUppercaseCharacters: false
AccountPasswordPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AccountPasswordPolicy resource accepts the following input properties:
- AllowUsers boolTo Change Password 
- Whether to allow users to change their own password
- HardExpiry bool
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- MaxPassword intAge 
- The number of days that an user password is valid.
- MinimumPassword intLength 
- Minimum length to require for user passwords.
- PasswordReuse intPrevention 
- The number of previous passwords that users are prevented from reusing.
- RequireLowercase boolCharacters 
- Whether to require lowercase characters for user passwords.
- RequireNumbers bool
- Whether to require numbers for user passwords.
- RequireSymbols bool
- Whether to require symbols for user passwords.
- RequireUppercase boolCharacters 
- Whether to require uppercase characters for user passwords.
- AllowUsers boolTo Change Password 
- Whether to allow users to change their own password
- HardExpiry bool
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- MaxPassword intAge 
- The number of days that an user password is valid.
- MinimumPassword intLength 
- Minimum length to require for user passwords.
- PasswordReuse intPrevention 
- The number of previous passwords that users are prevented from reusing.
- RequireLowercase boolCharacters 
- Whether to require lowercase characters for user passwords.
- RequireNumbers bool
- Whether to require numbers for user passwords.
- RequireSymbols bool
- Whether to require symbols for user passwords.
- RequireUppercase boolCharacters 
- Whether to require uppercase characters for user passwords.
- allowUsers BooleanTo Change Password 
- Whether to allow users to change their own password
- hardExpiry Boolean
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- maxPassword IntegerAge 
- The number of days that an user password is valid.
- minimumPassword IntegerLength 
- Minimum length to require for user passwords.
- passwordReuse IntegerPrevention 
- The number of previous passwords that users are prevented from reusing.
- requireLowercase BooleanCharacters 
- Whether to require lowercase characters for user passwords.
- requireNumbers Boolean
- Whether to require numbers for user passwords.
- requireSymbols Boolean
- Whether to require symbols for user passwords.
- requireUppercase BooleanCharacters 
- Whether to require uppercase characters for user passwords.
- allowUsers booleanTo Change Password 
- Whether to allow users to change their own password
- hardExpiry boolean
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- maxPassword numberAge 
- The number of days that an user password is valid.
- minimumPassword numberLength 
- Minimum length to require for user passwords.
- passwordReuse numberPrevention 
- The number of previous passwords that users are prevented from reusing.
- requireLowercase booleanCharacters 
- Whether to require lowercase characters for user passwords.
- requireNumbers boolean
- Whether to require numbers for user passwords.
- requireSymbols boolean
- Whether to require symbols for user passwords.
- requireUppercase booleanCharacters 
- Whether to require uppercase characters for user passwords.
- allow_users_ boolto_ change_ password 
- Whether to allow users to change their own password
- hard_expiry bool
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- max_password_ intage 
- The number of days that an user password is valid.
- minimum_password_ intlength 
- Minimum length to require for user passwords.
- password_reuse_ intprevention 
- The number of previous passwords that users are prevented from reusing.
- require_lowercase_ boolcharacters 
- Whether to require lowercase characters for user passwords.
- require_numbers bool
- Whether to require numbers for user passwords.
- require_symbols bool
- Whether to require symbols for user passwords.
- require_uppercase_ boolcharacters 
- Whether to require uppercase characters for user passwords.
- allowUsers BooleanTo Change Password 
- Whether to allow users to change their own password
- hardExpiry Boolean
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- maxPassword NumberAge 
- The number of days that an user password is valid.
- minimumPassword NumberLength 
- Minimum length to require for user passwords.
- passwordReuse NumberPrevention 
- The number of previous passwords that users are prevented from reusing.
- requireLowercase BooleanCharacters 
- Whether to require lowercase characters for user passwords.
- requireNumbers Boolean
- Whether to require numbers for user passwords.
- requireSymbols Boolean
- Whether to require symbols for user passwords.
- requireUppercase BooleanCharacters 
- Whether to require uppercase characters for user passwords.
Outputs
All input properties are implicitly available as output properties. Additionally, the AccountPasswordPolicy resource produces the following output properties:
- ExpirePasswords bool
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- Id string
- The provider-assigned unique ID for this managed resource.
- ExpirePasswords bool
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- Id string
- The provider-assigned unique ID for this managed resource.
- expirePasswords Boolean
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- id String
- The provider-assigned unique ID for this managed resource.
- expirePasswords boolean
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- id string
- The provider-assigned unique ID for this managed resource.
- expire_passwords bool
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- id str
- The provider-assigned unique ID for this managed resource.
- expirePasswords Boolean
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing AccountPasswordPolicy Resource
Get an existing AccountPasswordPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AccountPasswordPolicyState, opts?: CustomResourceOptions): AccountPasswordPolicy@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_users_to_change_password: Optional[bool] = None,
        expire_passwords: Optional[bool] = None,
        hard_expiry: Optional[bool] = None,
        max_password_age: Optional[int] = None,
        minimum_password_length: Optional[int] = None,
        password_reuse_prevention: Optional[int] = None,
        require_lowercase_characters: Optional[bool] = None,
        require_numbers: Optional[bool] = None,
        require_symbols: Optional[bool] = None,
        require_uppercase_characters: Optional[bool] = None) -> AccountPasswordPolicyfunc GetAccountPasswordPolicy(ctx *Context, name string, id IDInput, state *AccountPasswordPolicyState, opts ...ResourceOption) (*AccountPasswordPolicy, error)public static AccountPasswordPolicy Get(string name, Input<string> id, AccountPasswordPolicyState? state, CustomResourceOptions? opts = null)public static AccountPasswordPolicy get(String name, Output<String> id, AccountPasswordPolicyState state, CustomResourceOptions options)resources:  _:    type: aws:iam:AccountPasswordPolicy    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- AllowUsers boolTo Change Password 
- Whether to allow users to change their own password
- ExpirePasswords bool
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- HardExpiry bool
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- MaxPassword intAge 
- The number of days that an user password is valid.
- MinimumPassword intLength 
- Minimum length to require for user passwords.
- PasswordReuse intPrevention 
- The number of previous passwords that users are prevented from reusing.
- RequireLowercase boolCharacters 
- Whether to require lowercase characters for user passwords.
- RequireNumbers bool
- Whether to require numbers for user passwords.
- RequireSymbols bool
- Whether to require symbols for user passwords.
- RequireUppercase boolCharacters 
- Whether to require uppercase characters for user passwords.
- AllowUsers boolTo Change Password 
- Whether to allow users to change their own password
- ExpirePasswords bool
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- HardExpiry bool
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- MaxPassword intAge 
- The number of days that an user password is valid.
- MinimumPassword intLength 
- Minimum length to require for user passwords.
- PasswordReuse intPrevention 
- The number of previous passwords that users are prevented from reusing.
- RequireLowercase boolCharacters 
- Whether to require lowercase characters for user passwords.
- RequireNumbers bool
- Whether to require numbers for user passwords.
- RequireSymbols bool
- Whether to require symbols for user passwords.
- RequireUppercase boolCharacters 
- Whether to require uppercase characters for user passwords.
- allowUsers BooleanTo Change Password 
- Whether to allow users to change their own password
- expirePasswords Boolean
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- hardExpiry Boolean
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- maxPassword IntegerAge 
- The number of days that an user password is valid.
- minimumPassword IntegerLength 
- Minimum length to require for user passwords.
- passwordReuse IntegerPrevention 
- The number of previous passwords that users are prevented from reusing.
- requireLowercase BooleanCharacters 
- Whether to require lowercase characters for user passwords.
- requireNumbers Boolean
- Whether to require numbers for user passwords.
- requireSymbols Boolean
- Whether to require symbols for user passwords.
- requireUppercase BooleanCharacters 
- Whether to require uppercase characters for user passwords.
- allowUsers booleanTo Change Password 
- Whether to allow users to change their own password
- expirePasswords boolean
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- hardExpiry boolean
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- maxPassword numberAge 
- The number of days that an user password is valid.
- minimumPassword numberLength 
- Minimum length to require for user passwords.
- passwordReuse numberPrevention 
- The number of previous passwords that users are prevented from reusing.
- requireLowercase booleanCharacters 
- Whether to require lowercase characters for user passwords.
- requireNumbers boolean
- Whether to require numbers for user passwords.
- requireSymbols boolean
- Whether to require symbols for user passwords.
- requireUppercase booleanCharacters 
- Whether to require uppercase characters for user passwords.
- allow_users_ boolto_ change_ password 
- Whether to allow users to change their own password
- expire_passwords bool
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- hard_expiry bool
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- max_password_ intage 
- The number of days that an user password is valid.
- minimum_password_ intlength 
- Minimum length to require for user passwords.
- password_reuse_ intprevention 
- The number of previous passwords that users are prevented from reusing.
- require_lowercase_ boolcharacters 
- Whether to require lowercase characters for user passwords.
- require_numbers bool
- Whether to require numbers for user passwords.
- require_symbols bool
- Whether to require symbols for user passwords.
- require_uppercase_ boolcharacters 
- Whether to require uppercase characters for user passwords.
- allowUsers BooleanTo Change Password 
- Whether to allow users to change their own password
- expirePasswords Boolean
- Indicates whether passwords in the account expire. Returns trueifmax_password_agecontains a value greater than0. Returnsfalseif it is0or not present.
- hardExpiry Boolean
- Whether users are prevented from setting a new password after their password has expired (i.e., require administrator reset)
- maxPassword NumberAge 
- The number of days that an user password is valid.
- minimumPassword NumberLength 
- Minimum length to require for user passwords.
- passwordReuse NumberPrevention 
- The number of previous passwords that users are prevented from reusing.
- requireLowercase BooleanCharacters 
- Whether to require lowercase characters for user passwords.
- requireNumbers Boolean
- Whether to require numbers for user passwords.
- requireSymbols Boolean
- Whether to require symbols for user passwords.
- requireUppercase BooleanCharacters 
- Whether to require uppercase characters for user passwords.
Import
Using pulumi import, import IAM Account Password Policy using the word iam-account-password-policy. For example:
$ pulumi import aws:iam/accountPasswordPolicy:AccountPasswordPolicy strict iam-account-password-policy
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.