terraform-provider-aws

Terraform cyclic dependency

 ̄綄美尐妖づ 提交于 2021-01-28 20:21:17
问题 I'm trying to instantiate 3 aws_instances that are aware of each other ip address via Terraform. This of course results in a cyclic dependency. I was wondering what is the best way to overcome this problem. I've tried a couple of solutions: Instantiate 2 instances together, and then 1 instance that depends on those 2. In the third instance, have a user_data script that allows the instance to ssh into the other 2 instances to setup the necessary configs. It works, but I don't like the fact

CloudWatch metric alarm using Terraform

可紊 提交于 2021-01-27 21:59:31
问题 When trying to setup some CloudWatch alarms using Terraform for some reason it doesn't find the metrics and the alarm remains stuck in insufficient data. Terraform doesn't output any errors and I can find the metrics if I search manually in AWS. What am I missing here? Example a simple healthy host alarm point to a target group: #healthy host alarm resource "aws_cloudwatch_metric_alarm" "health" { alarm_name = "${var.tag_app}_healthy_host" comparison_operator = "LessThanThreshold" evaluation

Terraform cyclic dependency challenge

心已入冬 提交于 2021-01-27 16:51:12
问题 Ok, so most of this is working except... We have a user data template file for getting each new AWS server to register with Chef Automate. Chef refers to each client by the "node_name" set in the user data script, which is the instance id by default. But when viewing in the Chef UI or "knife node list", the instance id isn't exactly user friendly. We were able to write out a meaningful node_name using the template. Something like: data "template_file" "user-data-qa" { count = "${var.QA

Terraform: How to request AWS EC2 instances only in zones where the requested instance type is supported?

自作多情 提交于 2021-01-27 10:58:53
问题 Is there a way to get the availability zones where an instance type (e.g. t3.medium) is available before requesting the instance? I'm trying to run the following code and for certain regions it fails with the following error: Error: Error launching source instance: Unsupported: Your requested instance type (t3.micro) is not supported in your requested Availability Zone (us-east-1e). Please retry your request by not specifying an Availability Zone or choosing us-east-1a, us-east-1b, us-east-1c

Terraform: How to request AWS EC2 instances only in zones where the requested instance type is supported?

夙愿已清 提交于 2021-01-27 10:58:34
问题 Is there a way to get the availability zones where an instance type (e.g. t3.medium) is available before requesting the instance? I'm trying to run the following code and for certain regions it fails with the following error: Error: Error launching source instance: Unsupported: Your requested instance type (t3.micro) is not supported in your requested Availability Zone (us-east-1e). Please retry your request by not specifying an Availability Zone or choosing us-east-1a, us-east-1b, us-east-1c

How to concatenate S3 bucket name in Terraform variable and pass it to main tf file

痞子三分冷 提交于 2021-01-27 06:50:56
问题 I'm writing terraform templates to create two S3 buckets, however, my requirement is to concatenate their names in vars.tf and then pass it to main tf file. Below is the vars.tf and main s3.tf file. vars.tf: variable TENANT_NAME { default = "Mansing" } variable BUCKET_NAME { type = "list" default = ["bh.${var.TENANT_NAME}.o365.attachments", "bh.${var.TENANT_NAME}.o365.eml"] } s3.tf: resource "aws_s3_bucket" "b" { bucket = "${element(var.BUCKET_NAME, 2)}" acl = "private" } When do terraform

Can't use S3 backend with Terraform - missing credentials

家住魔仙堡 提交于 2021-01-27 04:17:16
问题 I have the most pedestrian of a Terraform sample: # Configure AWS provider provider "aws" { region = "us-east-1" access_key = "xxxxxxxxx" secret_key = "yyyyyyyyyyy" } # Terraform configuration terraform { backend "s3" { bucket = "terraform.example.com" key = "85/182/terraform.tfstate" region = "us-east-1" } } When I run terraform init I receive the following (traced) response: 2018/08/14 14:19:13 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161 2018/08/14 14:19:13

Can't use S3 backend with Terraform - missing credentials

三世轮回 提交于 2021-01-27 04:16:15
问题 I have the most pedestrian of a Terraform sample: # Configure AWS provider provider "aws" { region = "us-east-1" access_key = "xxxxxxxxx" secret_key = "yyyyyyyyyyy" } # Terraform configuration terraform { backend "s3" { bucket = "terraform.example.com" key = "85/182/terraform.tfstate" region = "us-east-1" } } When I run terraform init I receive the following (traced) response: 2018/08/14 14:19:13 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161 2018/08/14 14:19:13

EC2 instance creation

我与影子孤独终老i 提交于 2021-01-24 11:34:24
问题 I'm trying to create multiple EC2 instance but they have different AMIs, instance types and should be in different availability zones as shown below. I've tried a few different ways but can't make it work. locals { az_ami = [ {Name = "host1", type = "t3a.medium", az = "eu_west_2a", ami_id = "ami-01234abc"}, {Name = "host2", type = "t3a.micro", az = "eu_west_2b", ami_id = "ami-01234def"}, {Name = "host3", type = "t3a.medium", az = "eu_west_2b", ami_id = "ami-01234gef"}, {Name = "host4", type =

How to append stepfunction execution id to SageMaker job names?

心不动则不痛 提交于 2021-01-20 13:16:09
问题 I have a step function statemachine which creates SageMaker batch transform job, the definition is written in Terraform, I wanted to add the stepfunction execution id to the batch transform job names: in stepfunction terraform file: definition = templatefile("stepfuntion.json", { xxxx ) in the "stepfuntion.json": {... "TransformJobName": "jobname-$$.Execution.Id", } }, "End": true } } } But after terraform apply, it didn't generate the actual id, it gave me jobname-$$.Execution.Id , can