Questions tagged [terraform-provider-aws]

Terraform Provider for AWS.

Terraform Provider for AWS

Define infrastructure as code to manage the full lifecycle — create new resources, manage existing ones, and destroy those no longer needed.

https://github.com/terraform-providers/terraform-provider-aws

3866 questions
129
votes
5 answers

How to create an SSH key in Terraform?

I need to spin up a bunch of EC2 boxes for different users. Each user should be sandboxed from all the others, so each EC2 box needs its own SSH key. What's the best way to accomplish this in Terraform? Almost all of the instructions I've found want…
Abe
  • 22,738
  • 26
  • 82
  • 111
51
votes
5 answers

Conditional attributes in Terraform

Does Terraform support conditional attributes? I only want to use an attribute depending on a variable's value. Example: resource "aws_ebs_volume" "my_volume" { availability_zone = "xyz" size = 30 if ${var.staging_mode} == true: …
Basil Musa
  • 8,198
  • 6
  • 64
  • 63
49
votes
7 answers

Terraform - Delete all resources except one

I have a Terraform 0.11 project with 30-40 different resources. I would like to delete all of them except a few - and those few are logically related to each other. I was looking for something close to terraform destroy --except=resource-id but that…
rath
  • 3,655
  • 1
  • 40
  • 53
46
votes
5 answers

Terraform AWS Provider Error: Value for unconfigurable attribute. Can't configure a value for "acl": its value will be decided automatically

Just today, whenever I run terraform apply, I see an error something like this: Can't configure a value for "lifecycle_rule": its value will be decided automatically based on the result of applying this configuration. It was working…
46
votes
6 answers

How to write an if, else, elsif conditional statement in Terraform

Is there a way to write a conditional statement with multiple branches in terraform? I'm setting up a terraform module to create an Amazon Aurora cluster. I need to have an option for cross region replication so I need to decide the region of the…
ConscriptMR
  • 656
  • 1
  • 7
  • 16
39
votes
9 answers

Error refreshing state: state data in S3 does not have the expected content

When we try to run a terraform script with remote state handling we get the below issue: Error refreshing state: state data in S3 does not have the expected content. This may be caused by unusually long delays in S3 processing a previous…
37
votes
4 answers

Terraform provider/variable sharing in modules

Is there a way of abstracting the provider for all the modules defined in a project. for example, I have this project ├── modules │   ├── RDS │   └── VPC └── stacks ├── production │   └── main.tf └── staging └── main.tf and it…
a14m
  • 7,808
  • 8
  • 50
  • 67
32
votes
5 answers

Error installing provider "aws": openpgp: signature made by unknown entity

I am using terraform version 0.11.13, and this afternoon I am getting the following error in terraform init step Does it mean I've to upgrade the terraform version, is there a deprecation for this version for aws provider? Full logs: Successfully…
29
votes
5 answers

How to make Terraform to read AWS Credentials file?

I am trying to create an AWS S3 bucket using terraform and this is my code: provider "aws" { profile = "default" region = "ap-south-1" } resource "aws_s3_bucket" "first_tf" { bucket = "svk-pl-2909202022" acl = "private" } I have…
28
votes
2 answers

Sharing resources between Terraform workspaces

I have an infrastructure I'm deploying using Terraform in AWS. This infrastructure can be deployed to different environments, for which I'm using workspaces. Most of the components in the deployment should be created separately for each workspace,…
27
votes
4 answers

How to organize terraform modules for multiple environments?

Every Terraform guide on the web provides a partial solution that is almost always not the real picture. I get that, not everyone has the same infrastructure needs, but what worries me that the common scenario with: multiple environments (dev,…
27
votes
4 answers

Uploading Multiple files in AWS S3 from terraform

I want to upload multiple files to AWS S3 from a specific folder in my local device. I am running into the following error. Here is my terraform code. resource "aws_s3_bucket" "testbucket" { bucket = "test-terraform-pawan-1" acl =…
pawan19
  • 425
  • 1
  • 5
  • 10
27
votes
7 answers

Create AWS Athena view programmatically

Can you create views in Amazon Athena? outlines how to create a view using the User Interface. I'd like to create an AWS Athena View programatically, ideally using Terraform (which calls CloudFormation). I followed the steps outlined here:…
26
votes
6 answers

terraform copy/upload files to aws ec2 instance

We have cronjob and shell script which we want to copy or upload to aws ec2 instance while creating instance using terraform. we tried file provisioner : but its not wokring , and read this option does not work with all terraform version …
pratik
  • 733
  • 1
  • 8
  • 11
26
votes
4 answers

Execute Terraform apply with AWS assume role

I need to execute a Terraform template to provision infrastructure for an AWS account which I can access by assuming a role. The problem I have now is I do not have an IAM user in that AWS account so I do not have an aws_access_key_id or an…
1
2 3
99 100