terraform-provider-gcp

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

风流意气都作罢 提交于 2020-07-20 10:17:06
问题 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? 回答1: There is a Terraform resource definition called "google_project_service" that allows one to enable a service (API). This is documented at google_project_service. An example of usage appears to be: resource "google_project_service" "project" { project = "your-project-id" service =

ImagePullBackOff on GKE with Private Google Cloud Repository

半腔热情 提交于 2020-06-17 05:36:13
问题 I am creating a deployment in GKE with a following (standard) deployment apiVersion: apps/v1 kind: Deployment metadata: name: api-deployment spec: replicas: 1 selector: matchLabels: component: api template: metadata: labels: component: api spec: containers: - name: api image: eu.gcr.io/xxxx-xxx/api:latest imagePullPolicy: Always resources: requests: memory: "320Mi" cpu: "100m" limits: memory: "450Mi" cpu: "150m" ports: - containerPort: 5010 However, for some reason GKE complains about a

Importing a google_storage_bucket resource in Terraform state fails

扶醉桌前 提交于 2020-01-25 07:24:04
问题 I'm trying to import a google_storage_bucket storage bucket in my Terraform state: terraform import module.bf-nathan.google_storage_bucket.assets-bucket my-bucket However, it fails as follows: module.bf-nathan.google_storage_bucket.assets-bucket: Importing from ID "my-bucket"... module.bf-nathan.google_storage_bucket.assets-bucket: Import complete! Imported google_storage_bucket (ID: next-assets-bf-nathan-botfront-cloud) module.bf-nathan.google_storage_bucket.assets-bucket: Refreshing state..

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 =

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 | Retrieve the (client-key) certificate from Cloud SQL

大城市里の小女人 提交于 2019-12-13 08:29:51
问题 I would like to retrieve the client-key SSL key of cloudsql via Terraform, I was able to retrieve the server-ca and the client-cert via terraform but have no idea how to get the client-key file. TO retrieve the client-cert I have used the below mentioned point: Please look. resource "google_sql_ssl_cert" "client_cert" { depends_on = ["google_sql_database_instance.new_instance_sql_master", "google_sql_user.users"] common_name = "terraform1" project = "${var.project_id}" instance ="${google_sql

How to fix “An Unknown Error Occurred” when creating multiple Google Cloud SQL instances with private IP simultaneously?

无人久伴 提交于 2019-12-09 22:23:37
问题 Our cloud backend setup contains 5 Cloud SQL for Postgres instances. We manage our infrastructure using Terraform. We are using connecting them from GKE using a public IP and the Cloud SQL container. In order to simplify our setup we wish to get rid of the proxy containers by moving to a private IP. I tried following the Terraform guide. While a creating a single instance works fine, trying to create 5 instances simultaneously ends in 4 failed ones and one successful: The error which appears

Managing GKE and its deployments with Terraform

三世轮回 提交于 2019-12-08 15:44:38
I can use terraform to deploy a Kubernetes cluster in GKE . Then I have set up the provider for Kubernetes as follows: provider "kubernetes" { host = "${data.google_container_cluster.primary.endpoint}" client_certificate = "${base64decode(data.google_container_cluster.primary.master_auth.0.client_certificate)}" client_key = "${base64decode(data.google_container_cluster.primary.master_auth.0.client_key)}" cluster_ca_certificate = "${base64decode(data.google_container_cluster.primary.master_auth.0.cluster_ca_certificate)}" } By default, terraform interacts with Kubernetes with the user client ,