首页 > 解决方案 > 删除从 Terragrunt remote_state 制作的资源?

问题描述

除了手动之外,还有什么方法可以删除 Terragrunt 制作的资源remote_state

背景

当您第一次配置remote_state然后运行terragrunt init一个模块时,它会询问您是否要创建资源。当然,你喜欢“y”。

请参阅:https ://terragrunt.gruntwork.io/docs/features/keep-your-remote-state-configuration-dry/#create-remote-state-and-locking-resources-automatically

例如 terragrunt.hcl:

remote_state {
  backend = "s3"
  generate = {
    path      = "backend.tf"
    if_exists = "overwrite_terragrunt"
  }
  config = {
    bucket         = "test-${get_aws_account_id()}-iac-terraform"
    key            = "${path_relative_to_include()}/terraform.tfstate"
    region         = "us-east-2"
    encrypt        = true
    dynamodb_table = "test-${get_aws_account_id()}-iac-terraform-lock-table"
  }
}

期望

如果它将其制作的资源的状态文件上传到它制作的存储桶中,那就太好了。如果它发出命令删除这些资源,那就更好了。

标签: terragrunt

解决方案


推荐阅读