This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Lets say we have all resources under state /A using module A | |
# We decide to wrap all the resources of the module into a inner module B | |
# So now all resources that were orignally top level in A are now top level in B | |
# Normally if we try to plan our changes, terraform will want to delete all resources originally under A and create new ones under B | |
# However, we may not want that (what if our resources are vpc level resources that we cant afford to delete) | |
# Terraform provides a state move command | |
# We can list all the resources in a module via `terraform state list` | |
# We can pipe this list to xargs and for each resource we can move it to the new prefix, ie. under inner module B. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "local_file" "kube_config" { | |
content = "${var.kube_config}" | |
filename = "${path.module}/kubeconfig" | |
} | |
# Hacky way to force a dependency on some external resource (since modules dont support a depends_on) | |
data "template_file" "deps" { | |
template = "${join(",", var.depends_on)}" | |
} |
OlderNewer