terraform

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

How to call ansible playbook in terraform code?

强颜欢笑 提交于 2021-01-27 17:35:34
问题 I have an ansible playbook which works well , now I have to call that playbook using terrform scripts. Currently I m using code which is shown below but it results in error during terraform init as: Error: Unknown root level key: provisioner I am using Terraform v0.11.7 and the error occurs only when I run this specific code. Also my main.tf consists of only this code. The directory structure I have used is such as : . ├── create-user.yml ├── library │ └── mkpassword.py ├── main.tf ├──

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

How to import aws_lambda_permission in terraform

浪子不回头ぞ 提交于 2021-01-27 13:04:52
问题 How can I use terraform import with resources of type aws_lambda_permission in terraform? What should the second argument be? 回答1: At the time of writing Terraform does not have an importer for this resource, so it's not possible to import it automatically using the terraform import command. Since a Lambda permission is a subordinate resource belonging to a Lambda function, once there is support for importing it the most likely way it would be handled is to import it as a side-effect of

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

Terraform referencing output from another module with for_each

流过昼夜 提交于 2021-01-24 13:37:21
问题 I am having trouble referencing an output from a module in another module. The resources in the first module was deployed using for_each. The resources in the second module is trying to reference the resources from first module There are 2 modules created Security Group VM The intention is to assign the Security Group to the VM The following is the module for the Security Group variable "configserver" { type = map(object({ name = string location = string subnet = string availability_zone =