Kubernetes_namespace module and terragrunt recreate #542
-
Terraform version, Kubernetes provider version and Kubernetes versionTerraform configurationmain.tf namespace.hcl terragrunt.hcl QuestionDon't know why but figured out, that it seems to be a problem with remote_state If I User Kubernetes Backend, I have the problem above. If I use Local Backend I cannot reproduce this problem anymore Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
When using the You should set remote_state {
backend = "kubernetes"
generate = {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
}
config = {
config_path = "~/.kube/config"
secret_suffix = "${replace(path_relative_to_include(), "/", "-")}-state"
}
} |
Beta Was this translation helpful? Give feedback.
When using the
kubernetesbackend, you aren't dynamically adjusting thesecret_suffixbased on the module, which is causing all the terragrunt configurations to write to the same state object. Because they are all sharing the state file, Terraform is viewing the differences across the modules as a diff in the deployment.You should set
secret_suffixto dynamically change based on the importing config, which you should be able to accomplish with: