You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to rename/move/update the state of Terraform resources
Explain this with an example on how to remove duplication in Terraform configuration file with for_each and how the state can be moved to match the changes in the configuration file.
terraform state list to list all the resources in the Terraform state.
terraform state mv -dry-run SOURCE DESTINATION to double-check if what would happen is really what we want
If happy with the previous step, remove -dry-run from previous command, so terraform state mv SOURCE DESTINATION
As an extra, show how to loop in shell (with zsh) to avoid error-prone manual typing as much as possible:
forbucket_namein bookmarks recipes documents;do terraform state mv "scaleway_object_bucket_policy.bucket_policy_$bucket_name""scaleway_object_bucket_policy.bucket_policy[\"$bucket_name\"]";done
How to retrieve a sensitive value
When looking at the state of a resource, its sensitive values will always be masked. This is great to prevent security leaks, but what if, only once, I need to store this sensitive value in my password manager.
How to rename/move/update the state of Terraform resources
Explain this with an example on how to remove duplication in Terraform configuration file with
for_each
and how the state can be moved to match the changes in the configuration file.terraform state list
to list all the resources in the Terraform state.terraform state mv -dry-run SOURCE DESTINATION
to double-check if what would happen is really what we want-dry-run
from previous command, soterraform state mv SOURCE DESTINATION
As an extra, show how to loop in shell (with zsh) to avoid error-prone manual typing as much as possible:
How to retrieve a sensitive value
When looking at the state of a resource, its sensitive values will always be masked. This is great to prevent security leaks, but what if, only once, I need to store this sensitive value in my password manager.
It's possible with the command below:
The text was updated successfully, but these errors were encountered: