【问题标题】:Terraform Cognito User Pool can't run updateTerraform Cognito 用户池无法运行更新
【发布时间】:2021-11-20 02:46:47
【问题描述】:

我正在尝试使用 Terraform 部署 AWS Cognito 用户池。

第一次部署时一切正常,但是当我尝试第二次运行terraform apply-all 而不修改我的配置中的任何内容时,我得到:

Error: error updating Cognito User Pool (us-east-1_XXX): cannot modify or remove schema items

需要帮助!

我正在使用 Terraform 0.13.0 版和 Terragrunt 0.25.0。

这里是 terraform 配置资源,我使用 s3 作为后端。

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"
  }
}

谢谢

【问题讨论】:

  • 您好,您使用的是哪个版本的 terraform(和 aws 提供程序)?我们可以看看你的 terraform 代码吗?
  • @JaimeS 嗨!感谢您的回答。我用我使用的版本和我的 terraform 配置更新了我的问题。
  • 你解决过这个问题吗?
  • 嗨,不,我没有

标签: amazon-web-services terraform terraform-provider-aws terragrunt


【解决方案1】:

无法编辑现有用户池,需要新建一个,然后迁移用户。

观看来自 AWS https://www.youtube.com/watch?v=uoZ3l0CG4uw 的视频

【讨论】:

  • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
猜你喜欢
  • 1970-01-01
  • 2022-01-21
  • 2020-04-22
  • 2021-05-08
  • 2017-12-03
  • 2019-05-28
  • 2021-11-28
  • 2022-01-13
相关资源
最近更新 更多