Terraform contd..
Taint resources using terraform
- In Terraform we have options to taint
- Taint: During next apply delete and recreate the resource.
- For this lets write a simple template and taint some resource
- syntax for taint is
terraform taint <resource_type>.<resource_name>
- To unmark a resource tainted for replacement we can untaint before next terraform appply to undo the taint.
-
Graph: Refer Here for the changeset
- Immutable infrastructure: The approach we are following is immutable infrastructure. Any change in infrastructure can happen by the changes in the template. Every change is stored in version control system i.e. we have history of all the changes.
Lets add ec2 instance with public ip in web subnet
- For creating an ec2 instance we need
- ami id
- security group
- key pair (optional)
- Refer Here for the changes done to add ec2 instance.
- Now we are supposed to install some applications in the ec2 instance.