terraform

Terraform apply failed due to mismatch time

北战南征 提交于 2019-12-25 00:25:55
问题 I am trying to apply my infra changes with terraform's docker image from my CI pipeline using gitlab-ci. However, i am getting some timing related errors. I kind of suspect some kind of time drift somewhere? I have tried setting timezone and installing NTP and synching the timezone. I verified that the time and TZ has changed from the default UTC to my local timezone GMT+8. However, the error still occurs. Notice that the time elpased went from 20s to 8h so it seems to be there are some

How Do I Add Active Directory To APIM Using Terraform?

可紊 提交于 2019-12-24 19:58:36
问题 Following this article you can link Azure API Management to Users/Groups in Azure Active Directory. At the moment I am creating the APIM instance with Terraform resource "azurerm_api_management" "test" { name = "example-apim" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" publisher_name = "My Company" publisher_email = "company@terraform.io" sku { name = "Developer" capacity = 1 } } How do I add the Active Directory Identity

Start/stop instances across multiple cloud providers

家住魔仙堡 提交于 2019-12-24 14:42:49
问题 Assuming a cloud infrastructure across multiple cloud provider accounts (AWS, Azure and GC) built with Terraform. Is there any way to reboot instances using Terraform? If not, how do people easily and centrally reboot their instances created with Terraform? Thanks! 回答1: Terraform does not provide capacity to reboot your instances. At best, you could taint a resource, that means that terraform will destroy and recreate (which is obviously not the same the rebooting). Terraform is not the right

how to put in varable.tf to run script with data external in terraform

百般思念 提交于 2019-12-24 12:19:17
问题 This is the continutaion of the following contents i asked before. I want to identify the public ip of the terraform execution environment and add it to the security group My terraform direcotry structure is as follows. root/  ├ main.tf  ├ test.sh  ├ modules/aws  │  └ ssh.tf/  │  └ variables.tf/ test.sh #!/bin/sh -xe echo {\"ip\":\""`curl ipinfo.io/ip`"\"} main.tf module "aws" { source = "./modules/aws" } variables.tf variable ssh_ip_address { default = "xxx.xx.xx.xx" } ssh.tf resource "aws

How to use external data source in terraform with bash script

我只是一个虾纸丫 提交于 2019-12-24 11:00:09
问题 I have a bash script that will return a single AMI ID. I want to use that AMI ID returned from the bash script as an input for my launch configuration. data "external" "amiid" { program = ["bash", "${path.root}/scripts/getamiid.sh"] } resource "aws_launch_configuration" "bastion-lc" { name_prefix = "${var.lc_name}-" image_id = "${data.external.amiid.result}" instance_type = "${var.instance_type}" placement_tenancy = "default" associate_public_ip_address = false security_groups = ["${var

terraform does not detect changes to lambda source files

南楼画角 提交于 2019-12-24 09:23:50
问题 In my main.tf I have the following: data "template_file" "lambda_script_temp_file" { template = "${file("../../../fn/lambda_script.py")}" } data "template_file" "library_temp_file" { template = "${file("../../../library.py")}" } data "template_file" "init_temp_file" { template = "${file("../../../__init__.py")}" } data "archive_file" "lambda_resources_zip" { type = "zip" output_path = "${path.module}/lambda_resources.zip" source { content = "${data.template_file.lambda_script_temp_file

unable to parse JSON using terraform external data

白昼怎懂夜的黑 提交于 2019-12-24 09:19:14
问题 USE CASE I wanted to provision an EFS in a given region with an EC2 instance and then mount that instance with EFS and if EFS doesn't exist in that region then I need to provision an alternate of EFS . PROBLEMS Amazon is not offering EFS service in every region. There is no way to identify the availability of service using aws-cli . Already asked but didn't get an answer yet link WHAT I TRIED This is the case where amazon provide the service, If I run this command curl -ls https:/

Can i update an existing ec2 instance with terraform

不问归期 提交于 2019-12-24 09:07:47
问题 Is it possible to edit an existing resource example: an ec2 instance with the terraform template. Ex: I have a ec2 instance created with aws console, can i add that ec2 instance to add a new security group using the instance id in terraform template. I know this can't be done with cloud formation. Currently I can do this with Ansible, but i don't see a way to do it with terraform or cloudformation 回答1: Yes, you can! However you have to then manage the instance with Terraform. There's no way

How to iterate multiple resources over the same list?

情到浓时终转凉″ 提交于 2019-12-24 07:51:06
问题 New to Terraform here. I'm trying to create multiple projects (in Google Cloud) using Terraform. The problem is I've to execute multiple resources to completely set up a project. I tried count , but how can I tie multiple resources sequentially using count ? Here are the following resources I need to execute per project: Create project using resource "google_project" Enable API service using resource "google_project_service" Attach the service project to a host project using resource "google

Terraform unable to list provider registration status

青春壹個敷衍的年華 提交于 2019-12-24 06:33:21
问题 I am trying to run terraform apply on a folder with a tf file, after running init. However, I get the error below: Error running plan: 1 error(s) occurred: provider.azurerm: Unable to list provider registration status, it is possible that this is due to invalid credentials or the service principal does not have permission to use the Resource Manager API, Azure error: resources.ProvidersClien t#List: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service