We can give all the variables and equal values in the source code tf files , but problem with that if you like to change the values , you have to modify everywhere in the main source code . It could be complex to implement in production env and it’s not easy to use. So we can use variables in…
Month: April 2021
How to add rules in aws security group thorugh Terraform?
Creating AWS VPC security group very simple by Terraform. Note: Provider section is mentioned in separate tf file. ingress –> Inbound egress—>Outbound
How to create new AWS EC2 instance and assign EIP using Terraform?
In the other article we have seen how to create aws ec2 instance using Terraform. Now lets see how to create EIP and assign to the EC2 instance automatically using Terraform. In the below example you can insert your provider access key and secret key information’s. Here “aws_eip_association” will do the mapping function for EC2 id and EIP id .…
Displaying output in Terraform
After executing “terraform apply” normally it will show “the resource has been created” with some little information’s. If you like to see more attributes about resources or some specific values after resource creation you have to include output section in your tf source code file. For this example we will consider the scenario for creating EIP and S3 bucket in…
Know about Terraform State Files , Current State and Desired State
Terrafrom stores the state about your managed infrastructure and configuration . State/state files created from the TF files. This state is used by Terraform to map real world resources to your configuration, keep track of metadata. This state is stored by default in a local file named “terraform.tfstate”, but it can also be stored remotely, which works better in a…
How to destroy resources through Terraform?
In 3 ways we can destroy the resources through Terrafrom. 1.From the terrafrom init directroy – Where you keep the actual config files,2.Specifying the target with provider,3.Remove the resource code from your tf file. Option1: – From the terraform init directory #terraform destroy Here it will show clearly what are the resources can be deleted . In this example “yourec2”…