Home > Software engineering >  Terraform error while creating AWS Cognito User Pool
Terraform error while creating AWS Cognito User Pool

Time:12-09

Below is my terraform code to create AWS Cognito User Pool:

resource "aws_cognito_user_pool" "CognitoUserPool" {
name = "cgup-aws-try-cogn-createcgup-001"
password_policy {
    minimum_length = 8
    require_lowercase = true
    require_numbers = true
    require_symbols = true
    require_uppercase = true
    temporary_password_validity_days = 7
}
lambda_config {
    
}
schema {
    attribute_data_type = "String"
    developer_only_attribute = false
    mutable = false
    name = "sub"
    string_attribute_constraints {
        max_length = "2048"
        min_length = "1"
    }
    required = true
}

the code consists of several schemas, but I think that may be enough. It was exported from aws from an existing cognito user pool, but when I try a terraform plan I get the following error:

Error: "schema.1.name" cannot be longer than 20 character   
with aws_cognito_user_pool.CognitoUserPool,   
on main.tf line 216, in resource "aws_cognito_user_pool" "CognitoUserPool":  
216: resource "aws_cognito_user_pool" "CognitoUserPool" {

No matter how much I reduce the length of the name, I get the same error.

any idea, help what could be the problem?

CodePudding user response:

I tried to deploy

resource "aws_cognito_user_pool" "CognitoUserPool" {
name = "cgup-aws-try"
password_policy {
    minimum_length = 8
    require_lowercase = true
    require_numbers = true
    require_symbols = true
    require_uppercase = true
    temporary_password_validity_days = 7
}
lambda_config {
    
}
schema {
    attribute_data_type = "String"
    developer_only_attribute = false
    mutable = false
    name = "sub"
    string_attribute_constraints {
        max_length = "2048"
        min_length = "1"
    }
    required = true
  }
}

and it was succesfull.

Maybe try to start fresh in a new workspace.

  • Related