aka "how to develop the terraform 12+ stuff"
helpful tip, speed up cache by adding the following to your ~./bashrc
:
export TF_PLUGIN_CACHE_DIR=~/.terraform.d/plugin-cache
[[ -d "$TF_PLUGIN_CACHE_DIR" ]] || mkdir -p $TF_PLUGIN_CACHE_DIR
General process:
For this example, I was renaming 010-standard-vpc
to 010-vpc-splunk
in test/aws-us-gov/mdr-test-modelclient
.
cd 010-standard-vpc/
# clear out cache to make our lives easier
rm -rf .terragrunt-cache
# validate that we're on latest code
terragrunt-local apply
# Get the `bucket` and 'key' value
cat `find . -name 'backend.tf'`
# In this example:
# bucket = "afsxdr-terraform-state"
# key = "aws/test/aws-us-gov/mdr-test-modelclient/010-standard-vpc/terraform.tfstate"
aws --profile mdr-common-services-gov \
s3 mv \
s3://afsxdr-terraform-state/aws/test/aws-us-gov/mdr-test-modelclient/010-standard-vpc/terraform.tfstate \
s3://afsxdr-terraform-state/aws/test/aws-us-gov/mdr-test-modelclient/010-vpc-splunk/terraform.tfstate
# move and rename
cd ..
git mv 010-standard-vpc 010-vpc-splunk
cd 010-vpc-splunk
# Apply again: NOTE: The only changes should be to the tags. Do not accept any other changes, or you will have extra resources
rm -rf .terragrunt-cache
terragrunt-local apply
If you get:
Error refreshing state: state data in S3 does not have the expected content.
You forgot to rename the directory you're working in.
These notes will walk you through the Terragrunt git flow for making changes.
rm -rf .terragrunt-cache
to resolve "strange" errorsTF_VAR_instance_termination_protection=false terragrunt apply
TF_VAR_instance_termination_protection=false terragrunt destroy
colby-williams taught me: cp -ar to copy symlinks correctly.
ln -s ../../../../.tfswitch.toml .
ls -larth .tfswitch.toml -> ../../../../.tfswitch.toml