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
11 views

Terraform - aws_security_group_rule doesn't support import

I'm having a strange problem when trying to import an aws_security_group_rule into terraform. I'm running the latest version of TF (0.11.11) For example: terraform import module.ec2....
0
votes
0answers
13 views

Terraform functions

i was playing around with functions in terraform ,, and created this which works fine. zookeeper_ip_address = "${join(":2888:3888\n", aws_instance.zookeeper.*.private_ip)}:2888:3888" i.e it ...
0
votes
1answer
11 views

Terraform | AWS | vpc_id causing apply to fail

I am working on setting up a Cloud9 environment using Terraform, I ran into an issue when it comes to my Terraform apply and specifically: Error: Error applying plan: 1 error(s) occurred: * ...
1
vote
0answers
13 views

How to enable Google Maps and generate an API key using Terraform?

I've been trying to spin up a project from scratch over the Christmas break to automate the creation of my home network, one of those components is the Ubiquiti Controller which requires a Google Maps ...
1
vote
0answers
8 views

all volumes are geting deleted when one EC2 is being deleted via terraform

i am using this template to create aws resources. my count is 2, every thing is getting created as per plan,, i am attaching a 2nd ebs volume of 1 gb to both machines, which is also happening well, ...
1
vote
1answer
24 views

How do I install Terraform libvrit_cloudinit?

I have searched all day trying to find a document on how to install the libvirt_cloudinit provider for Terraform. When I execute a terraform plan I encounter this error message: Error: ...
0
votes
1answer
20 views

Understanding contents and workwise of a Terraform plan

If you export a Terraform plan, it is a binary file. Now, calls to a cloud management interface are HTTP calls following corresponding REST APIs. Does this mean this internal Terraform format ...
0
votes
0answers
9 views

Terraform: Cannot specify duplicate termination policy - [OldestInstance]

After running a terraform apply I get the following error output: Error: Error applying plan: 2 error(s) occurred: * module.leaderboards.aws_autoscaling_group.asg: 1 error(s) occurred: * ...
0
votes
0answers
27 views

Terraform error 403

I have a terraform setup that seems to only work part of the time, I get an error 403 and can't access resource manager API. What I don't understand is that I can use a simple terraform setup to ...
0
votes
0answers
17 views

How do I reproduce existing S3 lifecycle rules in Terraform?

I've used Terraforming to create a copy of my existing AWS infrastructure in Terraform but it doesn't support lifecycle rules at the moment. I have the following diff: lifecycle_rule.#: "1" => "0"...
0
votes
1answer
58 views

How can I use Docker Hub in Terraform?

The instructions in Terraform Docker Provider give the example: # Configure the Docker provider provider "docker" { host = "tcp://127.0.0.1:2376/" } # Create a container resource "docker_container"...
0
votes
1answer
54 views

How do I handle multiple AWS accounts in Terraform?

I've read up on Terraform and using AWS S3 and DynamoDB for sharing state and locking. My problem is that we have multiple AWS accounts, by which I mean multiple sign-in locations like: https://...
3
votes
1answer
73 views

Where do you start with hosting the infrastructure for your infrastructure?

So I'm trying to get started with the HashiCorp stack, but the question I keep asking myself, when looking at any of this DevOps infrastructure stuff, is what infrastructure should you be using to ...
0
votes
0answers
22 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 ...
2
votes
1answer
47 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
364 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
54 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 ...
1
vote
1answer
150 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
116 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
63 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 ...
-2
votes
1answer
38 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 ...
-2
votes
1answer
170 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
202 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. ...
2
votes
1answer
167 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 ...
3
votes
2answers
3k 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
58 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 ...
2
votes
1answer
622 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 ...
1
vote
1answer
66 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
260 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
90 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?
1
vote
0answers
54 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 ...
8
votes
1answer
238 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
307 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
279 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 ...
5
votes
1answer
142 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 ...
6
votes
6answers
223 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 ...
2
votes
2answers
99 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
580 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
293 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/...
5
votes
2answers
890 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
108 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
740 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
192 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
610 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....
2
votes
2answers
131 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
1k 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
312 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
260 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
105 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
3k 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 = "${...