Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [terraform]

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

0
votes
1answer
14 views

AWS ElasticBeanstalk Clone Prod to a temporary environment to debug

Is there a good approach to create a copy of prod environment just for devs to debug a bug that couldn't be reproduced or is there any appropriate setup in multi-tenant situation with multiple ...
1
vote
1answer
32 views

How do you handle the huge number of possible permutations of Dockerfiles / Teraform files?

We have adopted Docker and Terraform as the foundation forour devOps. We have a basic version of it up and running today. Dockerfiles live in each projects git repository and Terraform files are more ...
0
votes
2answers
31 views

Terraform plan -var-file=“myvars.vars” does not run [closed]

I try to lean terraform for usage with our AWS environment. I have created a .tf file and terraform init was successful. In the .tf file I have a number of variables that are populated via .var ...
0
votes
0answers
24 views

Terraform Project Organization with AWS VPC Peering Connections

How best does one organize a project for AWS that makes use of peering connections. At present my folder structure looks like this modules/ staging/ production/ provisioning/ peering/ I'm also ...
0
votes
1answer
50 views

Jenkins Pipeline job - remember previous values

I have a Jenkins Pipeline which uses Terraform and create a compute environment in GCP. There are like 5 questions in the build i.e. 1) GCP Project Name 2) Number of RHEL Servers 3) RHEL Server names ...
0
votes
1answer
31 views

Terraform resource definition for Azure App Service Environment

I am trying to create an Azure App Service Environment using Terraform. Is there any real-life working samples for this? How should we decide to use a terraform resource is there a tested resource ...
1
vote
0answers
41 views

Provisioning times for Redis in cloud taking too long, how can we shorten it?

Provisioning a 1 GB Redis cache service on AWS takes around 8 minutes. Doing the same on Azure takes around 16 minutes. Ours Terraform scripts need the call back from the Redis systems. Why is this ...
-1
votes
1answer
32 views

Set user in aws

I have a lot of instance in aws.I have build through terraform. I have made scripts of making user(e.g. user1 rather than ec2-user).But i am facing one issue.when i check .ssh/authorized_key. I have ...
-1
votes
1answer
37 views

Make instance with newuser by terraform

I want to make new instance with "user1" rather than ec2-user(AWS) default.i want achieve this by terraform. Like in azure terraform it can be done by "os_profile{}", but how can i do in aws by ...
5
votes
2answers
139 views

Terraform AWS AZ error - manually specify AZ?

I'm fairly new to terraform and when creating AWS infrastructure I use the following to fetch the 'available' availability zones for my region (us-east-1) where I'm trying to create an EKS cluster. ...
1
vote
1answer
51 views

Terraform Issue - Can't find Data Source in Sub Module?

I'm fairly new to Terraform and have been following this example on creating an EKS cluster - https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/eks-getting-started ...
1
vote
2answers
607 views

Terraform: apply only one tf file

I have my security groups in a securitygroup.tf file. In the same dir there are plenty of other resource descriptions (rds, ec2 etc). Is there a way to perform a terraform apply --auto-approve only ...
0
votes
0answers
37 views

Detecting IAM user policy attachment configuration drift with Terraform

I'm implementing Terraform to control and track configuration across our AWS deployments. As part of that I'm tracking all of our IAM users, roles, groups and policies, and an important part of this ...
1
vote
1answer
281 views

How to set an existing IAM role to a new instance while spinning in terraform?

I am trying to attach an existing role created in AWS, but I am not able to add it in Terraform Code. I tried to add the role in instance profile but it didn't work either for me. Is there any direct ...
0
votes
1answer
39 views

Deploying a SaaS solution which is custom for every customer

So we have 5 repositories (Individual web services ex. CMS/E-commerce and internal APIs) which are currently deployed as Docker containers. What we plan to do is to use these services and make a ...
1
vote
1answer
117 views

Terraform: ignore_changes conditionally? (temporary EC2 instance public IP address)

I've got a couple of EC2 instances managed by Terraform, with public IP addresses in a VPC. With each Terraform run, I'm updating DNS records based on those public IPs. I don't need these instances ...
0
votes
0answers
56 views

How to create PTR Records on OpenStack with Terraform?

While setting up a a test environment with terraform on OpenStack, I am missing something: How do I set reverse DNS / PTR records for floating IPs?
0
votes
0answers
24 views

Creating a buildspec inside the buildproject itself

I have used cloudformation using yaml to build a pipeline AWS Codepipeline and there was a clear option to update the build commands using the script, How can I include the build commands inside the ...
4
votes
1answer
169 views

How to add shards to a Redis cluster managed by Terraform without loosing all state?

I have set up a Redis cluster with Terraform. The setup looks like this: resource "aws_elasticache_replication_group" "instance" { replication_group_id = "test" node_type = "...
4
votes
4answers
83 views

How can I get terraforms extern to execute `ssh-keygen -y -f ~/.ssh/id_rsa`?

I seem to be confused about how external works. I tried: data "external" "local_key" { program = [ "ssh-keygen", "-y", "-f ~/.ssh/id_rsa" ] } This gives me: failed to execute "ssh-keygen":...
5
votes
1answer
209 views

Create multiple EC2 instances using python script (in loop iteration)

I Have JSON file in which email address and count of instances are specified.I'm using python script to iterate through that file and get username/count number (count number will be used as number of ...
4
votes
1answer
109 views

Terraform: Delay the MySQL Provider

I have a Terraform project which uses the MySQL provider. Because of the way Terraform works, the MySQL provider will fail to load correctly because the AWS_RDS instance doesn't exist. Is there a ...
5
votes
6answers
176 views

In the HashiCorp stack, where's the appropriate place to add users?

I'm in the process of building some custom Linux images using HashiCorp's Packer, which will later be deployed to Azure using HashiCorp's Terraform. The VMs created from these images will need to have ...
1
vote
2answers
76 views

Can jenkins control baremetal with ipmi

I have a setup with a bunch of blades that pxe boot into coreos using terraform/matchbox setup. I currently control them all manually using ipmitool from my desktop. Is there a way to let jenkins ...
4
votes
2answers
395 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
195 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/...
3
votes
2answers
506 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
95 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
510 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 ...
7
votes
3answers
157 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 ...
7
votes
1answer
368 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....
1
vote
2answers
98 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 ...
3
votes
1answer
761 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
245 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
213 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
85 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 ...
6
votes
3answers
1k 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
127 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
52 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? ...
2
votes
0answers
377 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 { ...
5
votes
1answer
547 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
353 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
408 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
576 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 ...
3
votes
3answers
351 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 Phyton apps on it. All OS patches should be applied to this image ...
3
votes
1answer
738 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 ...
7
votes
1answer
992 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
467 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 ...
24
votes
5answers
6k 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 / ...
7
votes
1answer
201 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 ...