微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

terraform 1.0.0 关于 github 存储库 ETAG 的奇怪消息已更改

如何解决terraform 1.0.0 关于 github 存储库 ETAG 的奇怪消息已更改

地形 1.0.0

terraform plan 显示以下消息

Note: Objects have changed outside of terraform

terraform detected the following changes made outside of terraform since the last "terraform
apply":

  # module.webrefresh-wordpress.github_repository.repository[0] has been changed
  ~ resource "github_repository" "repository" {
      ~ etag                   = "W/\"0a6acc64db34a0ae0d3ed9e6931dcc845ad0cf5f60113a6df4749c111b20a93a\"" -> "W/\"d1955c8eecde028f7360e767340e809796f6fb18b3c0a6bb0091d395334029df\""
        id                     = "test-webrefresh-wordpress"
        name                   = "test-webrefresh-wordpress"
        # (26 unchanged attributes hidden)
    }

Unless you have made equivalent changes to your configuration,or ignored the relevant
attributes using ignore_changes,the following plan may include actions to undo or respond to
these changes.

──────────────────────────────────────────────────────────────────────────────────────────────

No changes. Your infrastructure matches the configuration.

那么如何摆脱它?

尝试使用 terraform apply -refresh-only 但没有帮助。

这是我的 tf 代码块:


resource "github_repository" "repository" {
  count       = length(local.to_create_repositories)
  name        = local.to_create_repositories[count.index].name
  description = title(local.to_create_repositories[count.index].description)

  visibility             = local.to_create_repositories[count.index].github_visibility
  has_issues             = local.to_create_repositories[count.index].has_issues != null ? local.to_create_repositories[count.index].has_issues : true
  has_wiki               = local.to_create_repositories[count.index].has_wiki != null ? local.to_create_repositories[count.index].has_wiki : true
  allow_merge_commit     = local.to_create_repositories[count.index].allow_merge_commit != null ? local.to_create_repositories[count.index].allow_merge_commit : true
  allow_rebase_merge     = local.to_create_repositories[count.index].allow_rebase_merge != null ? local.to_create_repositories[count.index].allow_rebase_merge : true
  delete_branch_on_merge = local.to_create_repositories[count.index].delete_branch_on_merge != null ? local.to_create_repositories[count.index].delete_branch_on_merge : true
  auto_init              = local.to_create_repositories[count.index].auto_init != null ? local.to_create_repositories[count.index].auto_init : true
  archive_on_destroy     = true

  lifecycle {
    ignore_changes = [etag]
  }
}

解决方法

This is being trackedgithub provider 中作为依赖于要考虑的某些上游行为的问题。

upstream issue in Terraform core 特别值得一读,以了解为什么会发生这种情况。

在您的情况下,只要您没有任何引用 etag 输出的内容(这会令人惊讶),那么您可以放心地忽略它,因为它只是一个计算属性。您还可以删除该 lifecycle.ignore_changes = [etag] 块,因为它不会影响计算属性,因为它不是该资源可设置的。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?