Questions tagged [terraform]

Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.

Features:

  • Infrastructure as Code
  • Execution Plans
  • Resource Graph
  • Change Automation
392 questions
4
votes
1 answer

How to Terraform ElastiCache Redis cluster provisioning properly?

I am currently writing Terraform script to provision ElastiCache Redis Cluster. I have the following concern. In the script, I use a snapshot name to restore database from ElastiCache single Redis instance. I can spin up a new Redis cluster,…
4
votes
2 answers

Deploying to multiple accounts with Terraform?

I've been looking for a Terraform way to be able to deploy to multiple AWS accounts simultaneously in Terraform and coming up dry. AWS has the concept of doing this with Stacks but I'm not sure if there is a way to do this in TF? If so what would be…
ehime
  • 577
  • 2
  • 7
  • 15
4
votes
1 answer

Terraform accessing list elements from module output

Let's say I have a module, which generates some ids: module.tf: resource "random_id" "etcdapiserver-id" { byte_length = 4 count = "${var.etcd_apiserver_count}" } module_output.tf: output "etcdapiserver_hostname_list" { …
Victor Bessonov
  • 113
  • 1
  • 2
  • 9
4
votes
2 answers

Terraform destroy failing because Google SQL user owns databases

I'm using Terraform to provision a Google Cloud SQL PostgreSQL database using a google_sql_database_instance resource. I also create a user with a google_sql_user resource. After applying, I deploy my application which creates databases owned by…
4
votes
1 answer

Why is my AWS instance's private IP outside of the subnet's range?

I'm trying to launch an instance with the private IP address 172.31.32.101 using Terraform in my default VPC (CIDR 172.31.0.0/16), in the eu-west-1a subnet that has the CIDR 172.31.32.0/20. I can usually do this with no problem, but more and more I…
scrossan
  • 43
  • 1
  • 5
4
votes
2 answers

Does Terraform Deal with “known_hosts” upon changing infrastructure? If so, how?

I'm very new to terraform so maybe this is not a great question. But I'm running through [this Amazon EC2 example] and at one point it tries to SSH to the machine, I assume to install nginx. This is always bombing out for me, and I just see repeated…
Randy L
  • 147
  • 1
  • 8
3
votes
1 answer

Terraform: using exportCustomRoutes when setting peering connection

I am trying to set-up a peering connection between 2 VPC networks. One network (the transit one) configures static routes, and I would like to have those propagated to the peered network. Here's an example: ... data "google_compute_network"…
Oliver
  • 133
  • 5
3
votes
1 answer

GCP Service Account can't access IAM operations with permissions

I'm using Terraform to automate a lot of my GCP management because clicking is bad. I've got a "shared services" project that I'm trying to use to manage other projects. I'm trying to setup a new environment in another project and need a service…
TheBeege
  • 47
  • 1
  • 8
3
votes
0 answers

AWS with Terraform - Filtering public/private subnets (without relying on tags)

Request: I would like to spin an AWS ALB - For that I need at least two subnets in two different Availability Zones. (Terraform shows a very explicit error in case we forget - see Error #1 Below). I would like to check the current number of public…
RtmY
  • 277
  • 2
  • 9
3
votes
3 answers

terraform execute bash script into instance

What is the way of execute a sh script into ec2 instance when terraform is building resources? I created an ami with some files in directory for execute, if i enter via ssh i can execute file as follow: sh /home/resources/wso/bin/wso.sh I have a…
mleaf
  • 145
  • 1
  • 1
  • 5
3
votes
1 answer

Terraform: Use module instance's name inside module

I am using a Terraform module to deploy resources, using separate instances to deploy sets of those resources. I would like to be able to name those resources according to the instance's name. For example: module "thing1" { source =…
Drew
  • 83
  • 6
3
votes
1 answer

How do I connect Cloudfront to a private s3 bucket with terraform?

So I'm 90 percent there, but it appears that cloudfront is getting 500 errors from s3? I'm sure I'm just doing something wrong. I've read the various amazon documentation, but to me it seems so vague as to perhaps be useless. resource…
3
votes
0 answers

AWS Immutable Server data handling strategy

I have learnt about Immutable Server pattern, and it looks very cool. However, how do you handle data that you need to keep across different deployments, like logs or business data from your db ? I am using Neo4j as database, running on AWS EC2 (so…
rico
  • 141
  • 4
3
votes
1 answer

How to make terraform assume a different STS role for a single resource change on another account?

I have AWS subaccounts for development, QA and production under a main account that controls all of our route53 zones. I manage everything with Terraform. I use STSAssumeRole Cross account roles from that main account to access the sub accounts. I…
AlexV
  • 31
  • 1
  • 3
3
votes
1 answer

Problems creating AutoScaling Group with a Network Load Balancer (NLB) on AWS using Terraform

I'm trying to create na NLB using Terraform v0.11.0 (my application doesn't use HTTP, so I cannot use an ALB). Looking in the Hashcorp documentation, I could create the following code: resource "aws_lb" "lb" { name = "test" internal = false …
Tales Morais
  • 33
  • 1
  • 3
1
2
3
26 27