Im trying to use Terraform to deploy a AWS Cognito User Pool.
Everything runs fine on first deploy, but when i try to run a terraform apply-all
for a second time without modifying anything on my config, i get:
Error: error updating Cognito User Pool (us-east-1_XXX): cannot modify or remove schema items
Need help please!
Im using terraform version 0.13.0 with Terragrunt 0.25.0.
here is the terraform config ressource, i use s3 as backend.
terraform {
required_providers {
aws = {
version = ">= 3.0"
source = "hashicorp/aws"
}
}
}
provider "aws" {
region = var.region
profile = var.aws_profile
}
resource "aws_cognito_user_pool" "pool" {
name = "my-user-pool"
mfa_configuration = "OFF"
username_attributes = ["email"]
password_policy {
minimum_length = 8
}
schema {
name = "name"
attribute_data_type = "String"
developer_only_attribute = false
mutable = true
required = true
string_attribute_constraints {
max_length = 256
}
}
schema {
name = "family_name"
attribute_data_type = "String"
developer_only_attribute = false
mutable = true
required = true
string_attribute_constraints {
max_length = 256
}
}
schema {
name = "phone_number"
attribute_data_type = "String"
developer_only_attribute = false
mutable = true // false for "sub"
required = true // true for "sub"
string_attribute_constraints {
max_length = 256
}
}
account_recovery_setting {
recovery_mechanism {
name = "verified_email"
priority = 1
}
}
auto_verified_attributes = [
"email"
]
user_pool_add_ons {
advanced_security_mode = "OFF"
}
}
Thanks