terraform

Deploying Helm workloads with Terraform on GKE cluster

假装没事ソ 提交于 2021-02-19 06:19:06
问题 I am trying to use Terraform Helm provider (https://www.terraform.io/docs/providers/helm/index.html) to deploy a workload to GKE cluster. I am more or less following Google's example - https://github.com/GoogleCloudPlatform/terraform-google-examples/blob/master/example-gke-k8s-helm/helm.tf, but I do want to use RBAC by creating the service account manually. My helm.tf looks like this: variable "helm_version" { default = "v2.13.1" } data "google_client_config" "current" {} provider "helm" {

Terraform google bucket for static website for google storage - 403

﹥>﹥吖頭↗ 提交于 2021-02-19 05:23:07
问题 Trying to create a google bucket for the static website. provider "google" { project = "myprojectname-123" credentials = "${file("storage-admin.json")}" region = "us-central1" zone = "us-central1-c" } resource "google_storage_bucket" "STANDARD" { name = "mywebsite.com" storage_class = "STANDARD" location = "US" website { main_page_suffix = "index.html" not_found_page = "404.html" } } > terraform apply googleapi: Error 403: The bucket you tried to create is a domain name owned by another user.

Terraform AWS ACM certificates in us-east-1 for resources in eu-west-1

≯℡__Kan透↙ 提交于 2021-02-19 02:00:33
问题 I have a terraform module that provisions resources primarily in eu-west-1. I need an ACM certificate to attach to a Cloudfront distribution. The certificate must be provisioned in us-east-1. I have thus configured two providers: provider "aws" { version = "~> 1.0" region = "eu-west-1" } provider "aws" { version = "~> 1.0" region = "us-east-1" alias = "us-east-1" } In my module, I provision the certificate like so: resource "aws_acm_certificate" "cert" { provider = "aws.us-east-1" domain_name

Multiple provider versions with Terraform

馋奶兔 提交于 2021-02-17 06:09:21
问题 Does anyone know if it is possible to have a Terraform script that uses multiple provider versions? For example azurerm version 2.0.0 to create one resource, and 1.4.0 for another? I tried specifying the providers, as documented here: https://www.terraform.io/docs/configuration/providers.html However it doesn't seem to work as it tries to resolve a single provider that fullfills both 1.4.0 and 2.0.0. It errors like: No provider "azurerm" plugins meet the constraint "=1.4.0,=2.0.0". I'm asking

Multiple .tf files in a folder

我的梦境 提交于 2021-02-17 05:39:31
问题 I have a project that I inherited that has multiple .tf (main.tf, xyz.tf, ...) files in certain folders. When it does a source = "../<folder_name>" , what order are the files applied in ? I main.tf always applied first followed by the rest ? Note: These are different from the variables.tf and outputs.tf files. 回答1: In Terraform 0.11, regular *.tf files were loaded in alphabetical order and then override files were applied. When invoking any command that loads the Terraform configuration,

Terraform create multiple network interfaces with `for_each` and reference `azurerm_public_ip`

爱⌒轻易说出口 提交于 2021-02-11 17:10:54
问题 I have the following code: resource "azurerm_public_ip" "imaged_pub_ip" { for_each = var.create_vm_images ? var.vms_to_image : {} name = "${var.team_name}_${var.release}_imaged_public_ip_${each.value}" location = var.loc resource_group_name = "${var.team_name}_${var.release}_${var.owner}_${var.intention}" allocation_method = "Static" tags = { team = var.team_name environment = var.env_name useby = var.useby release = var.release devops_work_item_id = var.devops_work_item_id owner = var.owner

Terraform create multiple network interfaces with `for_each` and reference `azurerm_public_ip`

↘锁芯ラ 提交于 2021-02-11 17:10:10
问题 I have the following code: resource "azurerm_public_ip" "imaged_pub_ip" { for_each = var.create_vm_images ? var.vms_to_image : {} name = "${var.team_name}_${var.release}_imaged_public_ip_${each.value}" location = var.loc resource_group_name = "${var.team_name}_${var.release}_${var.owner}_${var.intention}" allocation_method = "Static" tags = { team = var.team_name environment = var.env_name useby = var.useby release = var.release devops_work_item_id = var.devops_work_item_id owner = var.owner

Create a complete Linux virtual machine infrastructure in Azure with Terraform

放肆的年华 提交于 2021-02-11 16:54:14
问题 So I'm very new creating virtual machines and Microsoft Azure. I'm trying to create one in terraform and link to my Azure account. I have been following this documentation: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-create-complete-vm. For some background; my goal is to create the VM, log in via ssh on a vpn and log the logins Using the sample code they provide however, I get this error: azurerm_virtual_machine.myterraformvm: compute.VirtualMachinesClient

Create a complete Linux virtual machine infrastructure in Azure with Terraform

青春壹個敷衍的年華 提交于 2021-02-11 16:52:20
问题 So I'm very new creating virtual machines and Microsoft Azure. I'm trying to create one in terraform and link to my Azure account. I have been following this documentation: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-create-complete-vm. For some background; my goal is to create the VM, log in via ssh on a vpn and log the logins Using the sample code they provide however, I get this error: azurerm_virtual_machine.myterraformvm: compute.VirtualMachinesClient

Unable to fetch data using external data source

拜拜、爱过 提交于 2021-02-11 15:23:21
问题 I am trying to fetch values from azure using external data source in terraform. However, i dont understand what am i doing wrong when i try to export values using write-output, getting an error data.external.powershell_test: data.external.powershell_test: command "Powershell.exe" produced invalid JSON: invalid character 'l' looking for beginning of object key string" Below is my script $vm=(Get-AzureRmVM -ResourceGroupName MFA-RG -Name vm2).name | convertTo-json Write-Output "{""first"" : ""