0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWSのCloudFormationのCognitoで発生した「Property validation failure: [Encountered unsupported properties in {/AdminCreateUserConfig}: [TemporaryPasswordValidityDays]]」を解消する

Posted at

はじめに

AWSのCognitoのCFnがよく理解できておらず、少し修正するとエラーが発生するのでメモ。
元々作成していたCFnをアップデートしたら壊れました。なんでや!

エラー

Property validation failure: [Encountered unsupported properties in {/AdminCreateUserConfig}: [TemporaryPasswordValidityDays]]
元々動いてたCFn.yaml
  CognitoUserPool:
    Type: "AWS::Cognito::UserPool"
    Properties:
      UserPoolName: "user-pool"
      AliasAttributes:
        - email
      AutoVerifiedAttributes:
        - email
      Policies:
        PasswordPolicy:
          MinimumLength: 8
          RequireUppercase: true
          RequireLowercase: true
          RequireNumbers: true
          RequireSymbols: true
      MfaConfiguration: 'OFF'
      AdminCreateUserConfig:
        AllowAdminCreateUserOnly: false
        UnusedAccountValidityDays: 7
エラーが発生したCFn.yaml
  CognitoUserPool:
    Type: "AWS::Cognito::UserPool"
    Properties:
      UserPoolName: "user-pool"
      AliasAttributes:
        - email
      AutoVerifiedAttributes:
        - email
      Policies:
        PasswordPolicy:
          MinimumLength: 8
          RequireUppercase: true
          RequireLowercase: true
          RequireNumbers: true
          RequireSymbols: true
      MfaConfiguration: 'ON'
      AdminCreateUserConfig:
        AllowAdminCreateUserOnly: false
        UnusedAccountValidityDays: 7

解決

UserPoolClientを作成すると、「MfaConfiguration: 'ON'」が指定できない。

「OPTIONAL」なら指定可能。

ドキュメントには書いてない。

以下を参照して解決.

UserPoolClientを作成すると「AdminCreateUserConfig」の「UnusedAccountValidityDays」は使用出来ないらしい。

ドキュメントに書いてました。

解決したコード

  CognitoUserPool:
    Type: "AWS::Cognito::UserPool"
    Properties:
      UserPoolName: !Sub "${ServiceName}-users-pool"
      AliasAttributes:
        - email
      AutoVerifiedAttributes:
        - email
      Policies:
        PasswordPolicy:
          MinimumLength: 8
          RequireUppercase: true
          RequireLowercase: true
          RequireNumbers: true
          RequireSymbols: true
      MfaConfiguration: 'OPTIONAL'
      EnabledMfas: 
        - SOFTWARE_TOKEN_MFA
      AccountRecoverySetting: 
        RecoveryMechanisms: 
            - Name: verified_email
              Priority: 1
      AdminCreateUserConfig:
        AllowAdminCreateUserOnly: false
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?