Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Terraform provider and update config accordingly #2208

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions iac/tf-multienv-cicd-anthos-autopilot/artifact-registry.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ resource "google_artifact_registry_repository" "container_registry" {
description = "Bank of Anthos docker repository"
project = var.project_id

provider = google-beta

depends_on = [
module.enabled_google_apis
]
Expand Down
6 changes: 2 additions & 4 deletions iac/tf-multienv-cicd-anthos-autopilot/env-development.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module "gke_development" {
enable_vertical_pod_autoscaling = true
horizontal_pod_autoscaling = true
create_service_account = false # currently not supported by terraform for autopilot clusters
deletion_protection = false
cluster_resource_labels = { "mesh_id" : "proj-${data.google_project.project.number}" }

providers = {
Expand Down Expand Up @@ -85,7 +86,6 @@ resource "google_service_account_iam_member" "gke_workload_development_admin" {

# create fleet membership for development GKE cluster
resource "google_gke_hub_membership" "development" {
provider = google-beta
project = var.project_id
membership_id = "development-membership"
endpoint {
Expand All @@ -108,7 +108,6 @@ resource "google_gke_hub_feature_membership" "asm_development" {
mesh {
management = "MANAGEMENT_AUTOMATIC"
}
provider = google-beta
}


Expand All @@ -121,6 +120,7 @@ resource "google_gke_hub_feature_membership" "acm_development" {
membership = google_gke_hub_membership.development.membership_id
configmanagement {
config_sync {
enabled = true
git {
sync_repo = local.sync_repo_url
sync_branch = var.sync_branch
Expand All @@ -130,6 +130,4 @@ resource "google_gke_hub_feature_membership" "acm_development" {
source_format = "unstructured"
}
}
provider = google-beta
}

5 changes: 2 additions & 3 deletions iac/tf-multienv-cicd-anthos-autopilot/env-production.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module "gke_production" {
enable_vertical_pod_autoscaling = true
horizontal_pod_autoscaling = true
create_service_account = false # currently not supported by terraform for autopilot clusters
deletion_protection = false
cluster_resource_labels = { "mesh_id" : "proj-${data.google_project.project.number}" }

providers = {
Expand Down Expand Up @@ -107,7 +108,6 @@ module "cloudsql_production" {

# create fleet membership for production GKE cluster
resource "google_gke_hub_membership" "production" {
provider = google-beta
project = var.project_id
membership_id = "production-membership"
endpoint {
Expand All @@ -130,7 +130,6 @@ resource "google_gke_hub_feature_membership" "asm_production" {
mesh {
management = "MANAGEMENT_AUTOMATIC"
}
provider = google-beta
}

# configure ACM for production GKE cluster
Expand All @@ -142,6 +141,7 @@ resource "google_gke_hub_feature_membership" "acm_production" {
membership = google_gke_hub_membership.production.membership_id
configmanagement {
config_sync {
enabled = true
git {
sync_repo = local.sync_repo_url
sync_branch = var.sync_branch
Expand All @@ -151,7 +151,6 @@ resource "google_gke_hub_feature_membership" "acm_production" {
source_format = "unstructured"
}
}
provider = google-beta
}

resource "google_compute_global_address" "production_ip" {
Expand Down
5 changes: 2 additions & 3 deletions iac/tf-multienv-cicd-anthos-autopilot/env-staging.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module "gke_staging" {
enable_vertical_pod_autoscaling = true
horizontal_pod_autoscaling = true
create_service_account = false # currently not supported by terraform for autopilot clusters
deletion_protection = false
cluster_resource_labels = { "mesh_id" : "proj-${data.google_project.project.number}" }

providers = {
Expand Down Expand Up @@ -107,7 +108,6 @@ module "cloudsql_staging" {

# create fleet membership for staging GKE cluster
resource "google_gke_hub_membership" "staging" {
provider = google-beta
project = var.project_id
membership_id = "staging-membership"
endpoint {
Expand All @@ -130,7 +130,6 @@ resource "google_gke_hub_feature_membership" "asm_staging" {
mesh {
management = "MANAGEMENT_AUTOMATIC"
}
provider = google-beta
}

# configure ACM for staging GKE cluster
Expand All @@ -142,6 +141,7 @@ resource "google_gke_hub_feature_membership" "acm_staging" {
membership = google_gke_hub_membership.staging.membership_id
configmanagement {
config_sync {
enabled = true
git {
sync_repo = local.sync_repo_url
sync_branch = var.sync_branch
Expand All @@ -151,5 +151,4 @@ resource "google_gke_hub_feature_membership" "acm_staging" {
source_format = "unstructured"
}
}
provider = google-beta
}
4 changes: 0 additions & 4 deletions iac/tf-multienv-cicd-anthos-autopilot/fleet-features.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ resource "google_gke_hub_feature" "asm" {
name = "servicemesh"
location = "global"
project = var.project_id

provider = google-beta

depends_on = [
module.enabled_google_apis
Expand All @@ -30,8 +28,6 @@ resource "google_gke_hub_feature" "acm" {
name = "configmanagement"
location = "global"
project = var.project_id

provider = google-beta

depends_on = [
module.enabled_google_apis
Expand Down
6 changes: 3 additions & 3 deletions iac/tf-multienv-cicd-anthos-autopilot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.40.0"
version = "~> 5.43.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 5.40.0"
version = "~> 5.43.0"
}
}
}

# google-beta provider for fleet API, artifact registry
# google-beta provider retained for version pinning
provider "google-beta" {
project = var.project_id
region = var.region
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ resource "google_clouddeploy_delivery_pipeline" "delivery-pipeline" {
}
}
}
provider = google-beta
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ resource "google_artifact_registry_repository_iam_member" "cloud_build" {
role = "roles/artifactregistry.writer"
member = "serviceAccount:${google_service_account.cloud_build.email}"

provider = google-beta
depends_on = [ google_service_account.cloud_build ]
}

resource "google_service_account_iam_member" "cloud_build_impersonate_cloud_deploy" {
service_account_id = var.cloud_deploy_sa.id
role = "roles/iam.serviceAccountUser"
member = "serviceAccount:${google_service_account.cloud_build.email}"
}