Questions tagged [terraform-provider-gcp]

The Google provider for Terraform is a plugin used to manage resources and API interactions with the Google Cloud Platform.

1097 questions
60
votes
11 answers

"Invalid legacy provider address" error on Terraform

I'm trying to deploy a bitbucket pipeline using terraform v0.14.3 to create resources in google cloud. after running terraform command, the pipeline fails with this error: Error: Invalid legacy provider address This configuration or its associated…
Laura H.
  • 661
  • 1
  • 5
  • 6
35
votes
6 answers

Can I automatically enable APIs when using GCP cloud with terraform?

I am very new to GCP with terraform and I want to deploy all my modules using centralized tools. Is there any way to remove the step of enabling google API's every time so that deployment is not interrupted?
26
votes
3 answers

What is the meaning of "authoritative" and "authoritative" for GCP IAM bindings/members

I am trying to understand the difference between google_service_account_iam_binding and google_service_account_iam_member in the GCP terraform provider at https://www.terraform.io/docs/providers/google/r/google_service_account_iam.html. I understand…
jamiet
  • 10,501
  • 14
  • 80
  • 159
25
votes
2 answers

Make Terraform resource key multiline

I am declaring a google_logging_metric resource in Terraform (using version 0.11.14) I have the following declaration resource "google_logging_metric" "my_metric" { description = "Check for logs of some cron job\t" name = "mycj-logs" …
pkaramol
  • 16,451
  • 43
  • 149
  • 324
24
votes
2 answers

How to properly create gcp service-account with roles in terraform

Here is the terraform code I have used to create a service account and bind a role to it: resource "google_service_account" "sa-name" { account_id = "sa-name" display_name = "SA" } resource "google_project_iam_binding"…
19
votes
4 answers

How to install multiple or two versions of Terraform?

I have a lot of Terraform modules written in Terraform 0.11 using gcp-provider of Terraform and want to upgrade the same to Terraform 0.12. For this purpose, I need to keep both the versions installed on my system and use the version according to…
Amit Yadav
  • 4,422
  • 5
  • 34
  • 79
17
votes
3 answers

Want to assign multiple Google cloud IAM roles to a service account via terraform

I want to assign multiple IAM roles to a single service account through terraform. I prepared a TF file to do that, but it has an error. With a single role it can be successfully assigned but with multiple IAM roles, it gave an error. data…
15
votes
1 answer

Incorrect Service Networking config for instance: xxxx:SERVICE_NETWORKING_NOT_ENABLED

I'm trying to replicate a SQL instance in GCP via terraform. The active instance has a public IP, however subnets from a secondary project are shared with the project hosing the SQL instance, and the SQL instance is associated with the secondary…
15
votes
3 answers

What is the mechanism of Terraform state locking when using Google Cloud Platform?

What is the Google Cloud Platform mechanism for locking state file when using Terraform? Something like DynamoDB on AWS... thanks
14
votes
4 answers

Terraform check if resource exists before creating it

Is there a way in Terraform to check if a resource in Google Cloud exists prior to trying to create it? I want to check if the following resources below exist in my CircleCI CI/CD pipeline during a job. I have access to terminal commands, bash, and…
Mule
  • 748
  • 1
  • 9
  • 24
13
votes
1 answer

terraform plan notifies of changes in infrastructure but also saying No changes

When I run terraform plan it shows a list of changes made out of Terraform and at the end of output, it also informs that "No changes. Your infrastructure matches the configuration.": Note: Objects have changed outside of Terraform Terraform…
Waqas Khan
  • 389
  • 1
  • 3
  • 8
13
votes
3 answers

Automate GCP persistent disk initialization

Are there any scripts that automate persistent disks formatting and attaching to the Google Cloud VM instance, instead of doing formatting & mounting steps? The persistent disk is created with Terraform, which also creates a VM and attaches the…
12
votes
5 answers

terraform kubectl provider not found

I'm trying to add kubectl provider for terraform module and I follow the docs from Terraform kubectl. I run terraform init and provider is installed with success but when I try to add a sample config, for ex: ( or thers from here ) resource…
Padi
  • 711
  • 9
  • 18
12
votes
3 answers

Google Cloud credentials with Terraform

This is a bit of a newbie question, but I've just gotten started with GCP provisioning using Terraform / Terragrunt, and I find the workflow with obtaining GCP credentials quite confusing. I've come from using AWS exclusively, where obtaining…
11
votes
1 answer

terraform returns 'invalid_grant' for GCP when attempting to create load balancer and I cannot view or edit SA permissions as owner

I have a brand new GCP account that I'm the only owner of, this is a personal/clean brand new project. I manage the infrastructure exclusively with terraform and trying to create a HTTPS load balancer to route requests to a fixed ip, which I then…
1
2 3
73 74