4 min read
Since MinIO is an object storage server that implements the same public API as Amazon S3, can it be used to store terraform's state?
15/06/2021
Read more...1 min read
To be able to get a list of resources managed by terraform we can use terraform state list for listing all the resources on the terraform state:
07/05/2021
Read more...3 min read
If we have some of the infrastructure that were created manually we can still import it into the terraform state. This ensures you can have a smooth transition from manually created resources to Infrastructure as Code
To do so we will be using then terraform import command:
$ terraform import
The import command expects two arguments.
Usage: terraform import [options] ADDR ID
(...)
04/05/2021
Read more...3 min read
Terraform keeps a list of managed objects on it's state, if for some reason we no longer want terraform to manage them we can remove them from the code base. Doing so we will see how terraform will try to delete them:
$ terraform plan
(...)
Plan: 0 to add, 0 to change, 10 to destroy.
(...)
30/04/2021
Read more...3 min read
When handling Infrastructure as Code (IaC) with terraform, refactoring the code might cause terraform to try to delete the existing resources an recreate them using a different name:
# module.jenkins.module.worker.module.kms-parameter-store.aws_iam_policy.kms_read_policy will be destroyed
# module.jenkins.module.worker.module.kms-parameter-store.aws_iam_policy.ssm_read_policy will be destroyed
# module.jenkins.module.worker.module.kms-parameter-store.aws_iam_role_policy_attachment.kms_read_policy_attachment will be destroyed
# module.jenkins.module.worker.module.kms-parameter-store.aws_iam_role_policy_attachment.ssm_role_policy_attachment will be destroyed
# module.jenkins.module.worker.module.kms-parameter-store.aws_kms_alias.kms_key_alias will be destroyed
# module.jenkins.module.worker.module.kms-parameter-store.aws_kms_key.kms_key will be destroyed
# module.jenkins.module.worker[0].module.kms-parameter-store.aws_iam_policy.kms_read_policy will be created
# module.jenkins.module.worker[0].module.kms-parameter-store.aws_iam_policy.ssm_read_policy will be created
# module.jenkins.module.worker[0].module.kms-parameter-store.aws_iam_role_policy_attachment.kms_read_policy_attachment will be created
# module.jenkins.module.worker[0].module.kms-parameter-store.aws_iam_role_policy_attachment.ssm_role_policy_attachment will be created
# module.jenkins.module.worker[0].module.kms-parameter-store.aws_kms_alias.kms_key_alias will be created
# module.jenkins.module.worker[0].module.kms-parameter-store.aws_kms_key.kms_key will be created
While in some cases it's just fine to destroy the resources and recreate them back, in other cases it can cause a undesired service interruption just for deleting all the resources and recreate them back exactly with the same settings using slightly different name on the terraform state.
We can avoid it by renaming the resources in the terraform state to the name terraform is expecting
23/04/2021
Read more...