terraform

Terraform external data in metadata_startup_script

喜夏-厌秋 提交于 2020-01-06 06:36:14
问题 I'm going to parsing a token value from other .tf file into other .tf file I have tried to understand this link and also from this article data.tf data "external" "get_token" { program = ["/bin/sh", "${path.module}/get-token.sh"] } get-token.sh #!/bin/bash token=$(kubectl -n kube-system exec [POD_NAME] cat /var/lib/kube-proxy/kubeconfig 2>/dev/null | grep token | awk '{print $2}' proxy.tf ... metadata_startup_script = <<-EOT - name: kube-proxy user: token: ${lookup(data.external.get_token

Delay in creation of launch config in AWS

橙三吉。 提交于 2020-01-06 04:50:05
问题 Using Terraform, I have the following launch config and autoscale group resources defined: resource "aws_launch_configuration" "lc_name" { name = "lc_name" image_id = "ami-035d01348bb6e6070" instance_type = "m3.large" security_groups = ["sg-61a0b51b"] } #################### # Autoscaling group #################### resource "aws_autoscaling_group" "as_group_name" { name = "as_group_name" launch_configuration = "lc_name" vpc_zone_identifier = ["subnet-be1088f7","subnet-fa8d6fa1"] min_size = "1"

EMR creation task and core nodes not able to specify as “Max on demand” for spot pricing

旧巷老猫 提交于 2020-01-05 05:03:11
问题 core_instance_group { instance_type = "c4.large" instance_count = 1 ebs_config { size = "40" type = "gp2" volumes_per_instance = 1 } bid_price = "0.30" I would require the bid_price = "max on-demand". Not sure how to pass this parameter in terraform. 回答1: I figured out a way. However, included couple of scripts to fetch the price details. Something like this: AWS price cmd: InstanceType=$1 aws pricing get-products --filters Type=TERM_MATCH,Field=instanceType,Value=${InstanceType} Type=TERM

EMR creation task and core nodes not able to specify as “Max on demand” for spot pricing

时间秒杀一切 提交于 2020-01-05 05:03:10
问题 core_instance_group { instance_type = "c4.large" instance_count = 1 ebs_config { size = "40" type = "gp2" volumes_per_instance = 1 } bid_price = "0.30" I would require the bid_price = "max on-demand". Not sure how to pass this parameter in terraform. 回答1: I figured out a way. However, included couple of scripts to fetch the price details. Something like this: AWS price cmd: InstanceType=$1 aws pricing get-products --filters Type=TERM_MATCH,Field=instanceType,Value=${InstanceType} Type=TERM

Terraform 0.12 - Produce map/object from nested for loop

大兔子大兔子 提交于 2020-01-03 21:12:31
问题 As a follow up to Terraform 0.12 nested for loops. I am trying to produce an object out of a nested loop but failing miserably :( How would you go about producing: Outputs: association-list = { "policy1" = "user1" "policy2" = "user1" "policy2" = "user2" } From: iam-policy-users-map = { "policy1" = [ "user1" ] "policy2" = [ "user1", "user2" ] } I have tried many variations of: variable iam-policy-users-map { default = { "policy1" = [ "user1" ] "policy2" = [ "user1", "user2" ] } } locals {

Terraform 0.12 - Produce map/object from nested for loop

拈花ヽ惹草 提交于 2020-01-03 21:11:09
问题 As a follow up to Terraform 0.12 nested for loops. I am trying to produce an object out of a nested loop but failing miserably :( How would you go about producing: Outputs: association-list = { "policy1" = "user1" "policy2" = "user1" "policy2" = "user2" } From: iam-policy-users-map = { "policy1" = [ "user1" ] "policy2" = [ "user1", "user2" ] } I have tried many variations of: variable iam-policy-users-map { default = { "policy1" = [ "user1" ] "policy2" = [ "user1", "user2" ] } } locals {

Terraform fails to import key pair with Amazon EC2

我只是一个虾纸丫 提交于 2020-01-03 13:05:41
问题 Using Terraform 0.7.7. I have a simple Terraform file with the following: provider "aws" { access_key = "${var.access_key}" secret_key = "${var.secret_key}" region = "${var.region}" } resource "aws_instance" "personal" { ami = "${lookup(var.amis, var.region)}" instance_type = "t2.micro" } resource "aws_eip" "ip" { instance = "${aws_instance.personal.id}" } resource "aws_key_pair" "personal" { key_name = "mschuchard-us-east" public_key = "${var.public_key}" } Terraform apply yields the

Terraform fails to import key pair with Amazon EC2

大城市里の小女人 提交于 2020-01-03 13:04:14
问题 Using Terraform 0.7.7. I have a simple Terraform file with the following: provider "aws" { access_key = "${var.access_key}" secret_key = "${var.secret_key}" region = "${var.region}" } resource "aws_instance" "personal" { ami = "${lookup(var.amis, var.region)}" instance_type = "t2.micro" } resource "aws_eip" "ip" { instance = "${aws_instance.personal.id}" } resource "aws_key_pair" "personal" { key_name = "mschuchard-us-east" public_key = "${var.public_key}" } Terraform apply yields the

Create snapshots of multiple EBS volumes using Terraform

◇◆丶佛笑我妖孽 提交于 2020-01-03 04:33:14
问题 I am trying to create snapshots of certain EBS volumes based on tags in a particular AWS region using Terraform. I have tried filtering EBS volumes based on Tags. I can get a clear output of EBS volume id when only one tag value is specified in the filter attribute but for more than one values, i get the following error: data.aws_ebs_volume.ebs_volume: data.aws_ebs_volume.ebs_volume: Your query returned more than one result. Please try a more specific search criteria, or set most_recent

terraform destroy produces cycle error when no cycles present

你。 提交于 2020-01-02 12:26:54
问题 Terraform Version Terraform v0.12.1 Terraform Configuration Files main.tf in my root provider: provider "google" {} module "organisation_info" { source = "../../modules/organisation-info" top_level_domain = "smoothteam.fi" region = "us-central1" } module "stack_info" { source = "../../modules/stack-info" organisation_info = "${module.organisation_info}" } Here's module 'organisation-info': variable "top_level_domain" {} variable "region" {} data "google_organization" "organization" { domain =