首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Terraform Of Sync

Terraform Of Sync
EN

Stack Overflow用户
提问于 2018-05-15 14:38:18
回答 1查看 2.9K关注 0票数 3

我有一个问题,我的地形在某种程度上和部署的不一样,但我不知道为什么。根据我的git历史,管理认知用户池的文件自部署以来没有改变过,但是terraform认为它已经更改并抱怨更改需要强制使用新的资源。

terraform版本:0.11.7

AWS提供程序版本:1.14.1

我的地形code

代码语言:javascript
运行
复制
resource "aws_cognito_user_pool" "my_app" {
  name                          = "My App Pool"

  /* Fields that can work as aliases */
  alias_attributes              = [
    "email"
  ]

  /* Auto-verify these fields */
  auto_verified_attributes      = [
    "email"
  ]

  /* This is the template used to verify addresses / accounts */
  verification_message_template {
    default_email_option        = "CONFIRM_WITH_CODE"
  }

  admin_create_user_config {
    allow_admin_create_user_only = false
    invite_message_template {
      email_message             = <<EOF    
  {####}
  EOF

      email_subject             = "MyApp"
      sms_message               = "Welcome to MyApp.  Your username: {username} and password: {####}  Thank you!"
    }
  }

  email_verification_subject    = "MyApp's Confirmation Code"
  email_verification_message    = "Your confirmation code: {####}   Thank you."

password_policy {
    minimum_length              = 8
    require_lowercase           = true
    require_numbers             = true
    require_symbols             = true
    require_uppercase           = true
}

  schema {
    attribute_data_type         = "String"
    developer_only_attribute    = false
    mutable                     = true
    name                        = "email"
    required                    = true
  }

  schema {
    attribute_data_type         = "String"
    developer_only_attribute    = false
    mutable                     = true
    name                        = "custom1"
    required                    = false
  }

  schema {
    attribute_data_type         = "String"
    developer_only_attribute    = false
    mutable                     = true
    name                        = "custom2"
    required                    = false
  }

  tags {
    "name"                      = "MyApp"
    "Project"                   = "Terraform"
  }
}

我得到以下结果:

代码语言:javascript
运行
复制
  schema.3021841581.attribute_data_type:                              "String" => "" (forces new resource)
  schema.3021841581.developer_only_attribute:                         "false" => "false"
  schema.3021841581.mutable:                                          "true" => "false" (forces new resource)
  schema.3021841581.name:                                             "custom1" => "" (forces new resource)
  schema.3021841581.number_attribute_constraints.#:                   "0" => "0"
  schema.3021841581.required:                                         "false" => "false"
  schema.3021841581.string_attribute_constraints.#:                   "1" => "0" (forces new resource)
  schema.3021841581.string_attribute_constraints.0.max_length:        "" => ""
  schema.3021841581.string_attribute_constraints.0.min_length:        "" => ""

我尝试了terraform refresh,但是它没有工作。

通过执行terraform状态来显示状态,给出了

代码语言:javascript
运行
复制
 schema.3021841581.attribute_data_type                              = String
 schema.3021841581.developer_only_attribute                         = false
 schema.3021841581.mutable                                          = true
 schema.3021841581.name                                             = custom1
 schema.3021841581.number_attribute_constraints.#                   = 0
 schema.3021841581.required                                         = false
 schema.3021841581.string_attribute_constraints.#                   = 1

所以,我的问题是:

  1. 我知道这可能并不理想,但是有什么方法可以忽略或者跳过科尼图呢?我不想改变该服务的任何内容,需要保护它,因为我们的用户。
  2. 有没有办法在不破坏我的泳池的情况下找出它为什么认为有区别并解决它?
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-16 13:14:54

  1. 您可以在计划/应用操作中使用选项-target。您应该在这里传递要更新/创建的资源。Terraform将将操作限制在该资源上。如果您有依赖项,或者要更新/创建多个资源,则可以任意多次使用该选项。
  2. 如果由于某种原因,它不同步,也许可以使用terraform命令针对问题资源(Es)。这将尝试带来您已经部署的当前配置,但是这种方法有一些限制,而且并不是所有的东西都是导入的。
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50353006

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档