Questions tagged [terraform]

For questions about Terraform, an open source tool to maintain infrastructure.

Filter by
Sorted by
Tagged with
3
votes
2answers
2k views

What is the difference between modules and workspaces in Terraform

I currently use Terraform workspaces to configure different environments like dev, test, prod, and my code works fine. And I believe I can use workspaces to configure different regions as well. ...
1
vote
1answer
2k views

terraform chef provisioning - cannot validate certificate for 10.90.239.223 because it doesn't contain any IP SANs

While configuring the chef provisioner I am running into the following error after running 'terraform apply' chef_environment.terraform_01: Post https://10.90.239.223/organizations/mykitchen/...
7
votes
2answers
3k views

Does terraform support blue green deployments and roll backs out of the box

I have been trying use terraform for a while . any suggestions/tips on how I can handle blue green deployments . I see how terraform enables it with auto scale groups on aws . But I’d like run some ...
4
votes
1answer
225 views

difference between packer and matchbox

I have this setup to standup a baremetal machine: Terraform-> Matchbox \-> Chef-> Docker My colleague has a setup to standup VMs in AWS: Terraform-> Packer-> Chef-> ...
4
votes
1answer
2k views

create resource name based on terraform.workspace

I want to have different s3 names based on different environments using terraform. If I define the name in terraform.tfvar, it won't work: s3_bucket_name = "tf-${terraform.workspace}" If I ...
9
votes
3answers
375 views

How should we automatically rebuild immutable infrastructure when new packages are available?

We're going to be using Terraform to automate our infrastructure deployment and Packer to create the machine images deployed by Terraform. By following immutable infrastructure design principles, we ...
8
votes
1answer
2k views

How to organize infrastructure as code projects?

I have completed an Infrastructure-as-Code project using Terraform and Ansible. Currently, I organize my project as follows: Project1 Terraform ec2.tf rds.tf … variables....
4
votes
2answers
273 views

How to add ECS attributes to an instance using terraform

I heavily use ECS Attributes on our containerized infrastructure. I couldn't find terraform docs to achieve this. Do I need to execute aws cli commands manually to apply those attributes after ...
5
votes
1answer
5k views

How to apply using Terraform to launch multiple EC2 Resource with different configs (VPC not maintained by TF)

We are planning to use Terraform for provisioning EC2 instance which will host Oracle DB. While we are able to achieve this, there are some questions for which I am searching for suggestions / ...
4
votes
1answer
956 views

Unable to launch multiple EC2 instances in different availability zones using terraform

Whenever I try to launch the instances, I am getting the following error message. Please help with this. Error: Error applying plan: 3 error(s) occurred: * aws_instance.example[0]: 1 error(s) ...
2
votes
1answer
418 views

Deploying to VSphere with Packer and/or Terraform?

Scenario: Creating multiple VMs and deploying them to VSphere. Current development uses Packer and Ansible to provision a Fusion VM, with the aim of using Terraform to deploy to VSphere. Issue: I'...
2
votes
1answer
185 views

Reusable module in Terraform

I want to get an autoscaling group name variable in module_apps and use it in other modules - for example module_init. However when I try to run terraform plan it does not work. content of ...
14
votes
4answers
12k views

Terraform: Is there a concise syntax for specifying multiple tags for a resource?

To attach multiple tags to a resource, I currently use multiple tag blocks: resource "aws_autoscaling_group" "instance" { ... tag { key = "Name" value = "${...
6
votes
2answers
175 views

How to reconcile Infrastructure as Code and not storing env config in code?

When developing a Web App, and trying to adhere to what is generally considered best practice, e.g. The 12 factor app methodology etc. One key concept is to keep configuration and sensitive data out ...
2
votes
1answer
64 views

terraform - how should I clone my code repo?

I have a very simple terraform configuration. I boot up an aws instance of Ubuntu trusty and assign a security group. My question is who is responsible of getting the latest code from my code repo? ...
4
votes
1answer
771 views

How to provide multiple configs for EC2 node using Terraform and cloud-init?

I need to use several configs on my EC2 node using Terraform. data "template_cloudinit_config" "puppetserver_config" { gzip = true base64_encode = true part { ...
9
votes
1answer
2k views

Terraform: How to support releasing new versions of the code, running in parallel with the last stable release?

I have one service in production (on AWS), which follows the immutable server pattern. Its deployment looks like this: Create a new AMI with Packer Create a new CloudFormation stack, starting with an ...
1
vote
1answer
2k views

Why does the datasource “external” always fail?

so my issue here is that terraform really does not like a command I'm trying to run using an external datasource. I'm trying to hack my way around a problem where terraform wont wait for a KMS ...
1
vote
1answer
1k views

Terraform: How to use a variable inside of another variable?

I'm trying to design it so that all configurable parameters exist within variables.tf...the issue I'm running into currently is for provisioning EC2 instances. I'd like to be able to define the ...
2
votes
1answer
2k views

Terraform - resource repeated multiple times

I have a terraform plan which consists of multiple aws_sqs_queue resources which more of less share the same config. Before I remove any repeating configs and use variables I wanted to run terraform ...
5
votes
3answers
563 views

Baking Immutable Images

I am working on a project and we are trying to bake immutable images on containers as IaC. These images can have J2EE, .NET or Python apps on it. All OS patches should be applied to this image ...
3
votes
1answer
1k views

How does using packer and terraform in a CD pipeline compare to docker images built from git?

At work we have a Go CD pipeline for producing docker images, and scheduling docker containers with rancher. This works quite well. You can commit a change to the Docker image in Git, the pipeline ...
8
votes
1answer
3k views

How do I detach an existing volume and attach a new volume with Terraform?

Is there a way to detach EBS volume from existing EC2 instance and attach a new EBS volume using Terraform v0.9.2 ? I prefer to replace the volume rather than trying to destroy the instance and ...
4
votes
1answer
2k views

Terraform apply exit code on error [closed]

I'm using Terraform as part of a Jenkins Pipeline. When terraform apply encounters an error, it does not return a non-zero exit code. When running into a problem on Jenkins, it does not stop the ...
46
votes
6answers
20k views

How to test a Terraform Configuration?

If you had a Terraform configuration that had a moderate degree of complexity, how would you write tests around the configuration that could be executed as part of a Continuous Integration / ...
9
votes
1answer
592 views

How can I manage changes in desired capacity due to scaling policies in AutoScaling Group state?

How can I manage changes in desired capacity due to scaling policies in AutoScaling Group state in terraform? Specifically, suppose I provision an aws_autoscaling_group resource with terraform with a ...
57
votes
7answers
23k views

How can I manage secrets in .tf and .tfstate?

I would like to use the Terraform MySQL Provider to keep a list of mysql users and grants handy for creating new test environments. The .tf and .tfstate files both seem to want to store the MySQL ...
11
votes
2answers
378 views

How to create a host on a DigitalOcean team with Terraform?

Teams on Digital Ocean are very recent and there is no documentation about using them with Terraform. All information I can found is how to work with them manually. I was hoping that I could say ...
14
votes
2answers
157 views

How can I keep track of my Cloud Resource use?

I am trying to automate my AWS application deployment with Jenkins. Right now if we want to update the application in any of the environments, say UAT, we build our docker images, find the current ...
28
votes
2answers
27k views

How to use cloud-init with Terraform?

I am working with Digital Ocean and Terraform and I already can automate the domain, subdomain, network preferences and the host but there is a section called User data that looks like this: The ...

1 2 3
4