terraform-provider-aws

Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists

独自空忆成欢 提交于 2020-12-15 07:19:07
问题 When running terraform apply I get the following error Terraform AlreadyExistsException: An alias with the name arn:aws:kms:XXXXX:XXXXXXXXX:alias/myalias already exists I can confirm that the resource (the KMS-Key-Alias) exists on AWS. How can this happen? How can I resolve this? 回答1: The problem is that the resource was created, but the Terraform state does not contain this resource. How this can happen the resource was created manually in AWS the resource was created using Terraform but the

Terraform - Updating S3 Access Control: Question on replacing acl with grant

ⅰ亾dé卋堺 提交于 2020-12-15 06:17:48
问题 I have an S3 bucket which is used as Access logging bucket. Here is my current module and resource TF code for that: module "access_logging_bucket" { source = "../../resources/s3_bucket" environment = "${var.environment}" region = "${var.region}" acl = "log-delivery-write" encryption_key_alias = "alias/ab-data-key" name = "access-logging" name_tag = "Access logging bucket" } resource "aws_s3_bucket" "default" { bucket = "ab-${var.environment}-${var.name}-${random_id.bucket_suffix.hex}" acl =

Terraform - Updating S3 Access Control: Question on replacing acl with grant

时光怂恿深爱的人放手 提交于 2020-12-15 06:16:21
问题 I have an S3 bucket which is used as Access logging bucket. Here is my current module and resource TF code for that: module "access_logging_bucket" { source = "../../resources/s3_bucket" environment = "${var.environment}" region = "${var.region}" acl = "log-delivery-write" encryption_key_alias = "alias/ab-data-key" name = "access-logging" name_tag = "Access logging bucket" } resource "aws_s3_bucket" "default" { bucket = "ab-${var.environment}-${var.name}-${random_id.bucket_suffix.hex}" acl =

How to use Terraform modules for code re-use?

浪子不回头ぞ 提交于 2020-12-15 06:05:22
问题 Terraform v0.12.x I thought I understood Terraform modules for code re-use after reading the docs, but apparently not. Say I want to build a target group+EC2 instance infrastructure. I have this directory structure. /terraform /terraform/green.tf /terraform/blue.tf /terraform/module_ec2/ec2.tf /terraform/module_tg/tg.tf For example, /terraform/module_ec2/ec2.tf has this resource "aws_instance" "ec2" { ami = var.ami availability_zone = var.availability_zone .... } and /terraform/module_tg/tg

Terraform (0.12.29) import not working as expected; import succeeded but plan shows destroy & recreate

不想你离开。 提交于 2020-12-13 03:30:30
问题 Some Background: We have terraform code to create various AWS resources. Some of these resources are created per AWS account and hence are structured to be stored in a account-scope folder in our project. This was when we were only having one AWS region. Now our application is made multi-region and hence these resources are to be created per region for each AWS account. In order to do that we have now moved these TF scripts to region-scope folder which will be run per region. Since these

Terraform (0.12.29) import not working as expected; import succeeded but plan shows destroy & recreate

孤街浪徒 提交于 2020-12-13 03:27:47
问题 Some Background: We have terraform code to create various AWS resources. Some of these resources are created per AWS account and hence are structured to be stored in a account-scope folder in our project. This was when we were only having one AWS region. Now our application is made multi-region and hence these resources are to be created per region for each AWS account. In order to do that we have now moved these TF scripts to region-scope folder which will be run per region. Since these

Terraform (0.12.29) import not working as expected; import succeeded but plan shows destroy & recreate

ぃ、小莉子 提交于 2020-12-13 03:26:15
问题 Some Background: We have terraform code to create various AWS resources. Some of these resources are created per AWS account and hence are structured to be stored in a account-scope folder in our project. This was when we were only having one AWS region. Now our application is made multi-region and hence these resources are to be created per region for each AWS account. In order to do that we have now moved these TF scripts to region-scope folder which will be run per region. Since these