Terraform For Each Examples – How to use for_each | Devops Junction
Middleware Inventory Blog » Terraform
by Tapan Hegde
1y ago
In this post, we’ll try to cover Terraform looping constructs. We’ll cover the looping constructs that specifically work at the resource level. They handle resource creation itself. There are two Looping constructs. count: This is often brought up when talking about looping with Terraform. for_each: This technique is similar to the count method but has some advantages. It should be generally used overcount. The for_each argument will iterate over a data structure to configure resources or modules with each item in turn. It works best when the duplicate resources need to b ..read more
Visit website
Clone EC2 instance using Terraform – How to | Devops Junction
Middleware Inventory Blog » Terraform
by Sarav AK
1y ago
This is a familiar requirement for everyone I believe.  How to clone an EC2 instance and create a new instance with the same configuration. While we want to launch multiple EC2 instances of the same configuration there are multiple ways we follow. Creating Auto Scaling Group or Launch Template Create AMI Snapshot and Launch an instance from it. Create an EBS Volume Snapshot and attach it to a new instance etc While the Autoscaling group and Launch template are to have a single copy and create multiple instances. The second and third ways are what we usually do. So in this article, we ar ..read more
Visit website
Creating EKS Cluster with SPOT instances – Terraform | Devops Junction
Middleware Inventory Blog » Terraform
by Sarav AK
1y ago
In this article, we are going to see how to create an EKS Cluster with SPOT and OnDemand instances using Terraform. If you have prior experience with AWS, you might know what is SPOT instances and ondemand instances are.  Let us start with a quick introduction towards SPOT instances. Quick Introduction to AWS SPOT instances AWS Provides the unused/unoccupied EC2 instances for up to a 90% cheap rate in the name of SPOT instances. While these instances are just like the Default OnDemand EC2 instances, their availability is not guaranteed.  SPOT instances can be reallocated anytime to ..read more
Visit website
Store terraform state file on Terraform cloud Remote | Devops Junction
Middleware Inventory Blog » Terraform
by Sarav AK
1y ago
In this article, I am going to discuss how we can keep safe our terraform state file using terraform cloud. As a pioneer/Practioner of Terraform CLI, we hold responsible for Terraform state file which is the source of truth for our infrastructure. What if we lose this state file or delete it by mistake?? This would create havoc and terraform will try to create infra resource again!! We can keep your state file secure and share it with collaborators, by migrating it to Terraform Cloud without interrupting or recreating your existing infrastructure. Prerequisites Terraform installed in local ..read more
Visit website
Clone EBS Volumes between AWS EC2 with Pulumi | Devops Junction
Middleware Inventory Blog » Terraform
by Tapan Hegde
1y ago
I had an Infrastructure as an automation requirement recently, where I had to create a solution that will find EBS volumes attached to an EC2 instance and create snapshots of the same and clone it and attach these cloned volumes to another EC2 instance. I know it was a little complex to put in a single sentence. Let’s go once again Requirement is to Scan the Source EC2 instance and find the EBS volumes attached Create Snapshots ( Copy ) for all the EBS Volumes found Using the Snapshot, create a new EBS Volumes ( Clone ) Attach the newly created Clone EBS Volumes to the Target EC2 instance I ..read more
Visit website
Clone EC2 instance using Terraform – How to | Devops Junction
Middleware Inventory Blog » Terraform
by Sarav AK
1y ago
This is a familiar requirement for everyone I believe.  How to clone an EC2 instance and create a new instance with the same configuration. While we want to launch multiple EC2 instances of the same configuration there are multiple ways we follow. Creating Auto Scaling Group or Launch Template Create AMI Snapshot and Launch an instance from it. Create an EBS Volume Snapshot and attach it to a new instance etc While the Autoscaling group and Launch template are to have a single copy and create multiple instances. The second and third ways are what we usually do. So in this article, we ar ..read more
Visit website
Store terraform state file on Terraform cloud Remote | Devops Junction
Middleware Inventory Blog » Terraform
by Sarav AK
1y ago
In this article, I am going to discuss how we can keep safe our terraform state file using terraform cloud. As a pioneer/Practioner of Terraform CLI, we hold responsible for Terraform state file which is the source of truth for our infrastructure. What if we lose this state file or delete it by mistake?? This would create havoc and terraform will try to create infra resource again!! We can keep your state file secure and share it with collaborators, by migrating it to Terraform Cloud without interrupting or recreating your existing infrastructure. Prerequisites Terraform installed in local ..read more
Visit website
Creating EKS Cluster with SPOT instances – Terraform | Devops Junction
Middleware Inventory Blog » Terraform
by Sarav AK
1y ago
In this article, we are going to see how to create an EKS Cluster with SPOT and OnDemand instances using Terraform. If you have prior experience with AWS, you might know what is SPOT instances and ondemand instances are.  Let us start with a quick introduction towards SPOT instances. Quick Introduction to AWS SPOT instances AWS Provides the unused/unoccupied EC2 instances for up to a 90% cheap rate in the name of SPOT instances. While these instances are just like the Default OnDemand EC2 instances, their availability is not guaranteed.  SPOT instances can be reallocated anytime to ..read more
Visit website
Terraform For Each Examples – How to use for_each | Devops Junction
Middleware Inventory Blog » Terraform
by Tapan Hegde
1y ago
In this post, we’ll try to cover Terraform looping constructs. We’ll cover the looping constructs that specifically work at the resource level. They handle resource creation itself. There are two Looping constructs. count: This is often brought up when talking about looping with Terraform. for_each: This technique is similar to the count method but has some advantages. It should be generally used overcount. The for_each argument will iterate over a data structure to configure resources or modules with each item in turn. It works best when the duplicate resources need to b ..read more
Visit website
Terraform google_compute_instance Example – with Remote Exec
Middleware Inventory Blog » Terraform
by Sarav AK
1y ago
In this article, we are going to see how to create a Linux Virtual machine and provision it using the Terraform remote execution strategy. We are going to be using SSH method to connect to the Virtual machine and provision it on the go by executing some startup Shell script. We would also be discussing how to copy a file to the Linux machine during the creation and use it for provisioning. This would give you an idea of how to install software packages or products during the server creation and get it ready. In this article, we will be using some Shell commands and Shell scripts as our provis ..read more
Visit website

Follow Middleware Inventory Blog » Terraform on FeedSpot

Continue with Google
Continue with Apple
OR