代码之家  ›  专栏  ›  技术社区  ›  user389955

Terraform:如何在不改变Terraform版本的情况下升级Provider

  •  0
  • user389955  · 技术社区  · 5 年前

    当我尝试运行terraform apply时,我看到错误:

    aws_glue_catalog_database.test: Provider doesn't support resource: aws_glue_catalog_database
    

    Terraform v0.11.10
    + provider.archive v1.0.0
    + provider.aws v1.6.0
    + provider.null v1.0.0
    + provider.template v1.0.0
    

    我试图升级provider,但保持terraform版本v0.11.10不变。为此,我运行terraform init-upgrade,但看到以下警告:

    terraform init -upgrade
    Initializing the backend...
    Backend configuration changed!
    
    Terraform has detected that the configuration     specified for the backend
    has changed. Terraform will now check for existing state in the backends.
    
    
    Do you want to migrate all workspaces to "s3"?
      Both the existing "s3" backend and the newly     configured "s3" backend
     support workspaces. When migrating between      backends, Terraform will copy
      all workspaces (with the same names). THIS WILL     OVERWRITE any conflicting
      states in the destination.
    
      Terraform initialization doesn't currently migrate     only select workspaces.
      If you want to migrate a select number of     workspaces, you must manually
      pull and push those states.
    
      If you answer "yes", Terraform will migrate all     states. If you answer
      "no", Terraform will abort.
    

    我决定说“不”,因为上面的警告吓了我一跳。

    有人知道我说“是”而不把事情搞乱是否可以?或者我应该运行哪个terraform命令来升级provider而不改变terraform版本?谢谢。

    0 回复  |  直到 5 年前
        1
  •  1
  •   hhami    5 年前

    你正在做一个重要的版本升级,所以我担心总有风险。

    以下是一些可以帮助您突出风险的链接(如果您还没有看到它们):

    我不知道您的设置,但理想情况下,您应该首先在开发环境中执行此操作,这将有望缓解您更改状态文件的紧张情绪。