Skip to content

Commit

Permalink
add versions to source modules (GoogleCloudPlatform#500)
Browse files Browse the repository at this point in the history
Scoped to infra stage-1 for now.

Follow up PRs for any other source modules.

Avoid breaking changes to main dev branch
  • Loading branch information
annapendleton committed Apr 1, 2024
1 parent 193bcc3 commit bd4d7d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
12 changes: 4 additions & 8 deletions benchmarks/infra/stage-1/modules/gke-infra/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ data "google_container_cluster" "cluster" {
}

module "cluster-service-account" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/iam-service-account"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/iam-service-account?ref=v30.0.0&depth=1"
count = local.cluster_create ? 1 : 0
project_id = module.project.project_id
name = var.prefix
}

module "cluster-standard" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-cluster-standard"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-cluster-standard?ref=v30.0.0&depth=1"
count = local.cluster_create && !var.gke_autopilot ? 1 : 0
project_id = module.project.project_id
name = var.cluster_name
Expand All @@ -84,10 +84,6 @@ module "cluster-standard" {
master_authorized_ranges = var.cluster_create.master_authorized_ranges
master_ipv4_cidr_block = var.cluster_create.master_ipv4_cidr_block
}
default_nodepool = {
remove_pool = false
initial_node_count = 1
}
private_cluster_config = {
enable_private_endpoint = var.enable_private_endpoint
master_global_access = true
Expand Down Expand Up @@ -128,7 +124,7 @@ module "cluster-standard" {
}

module "cluster-autopilot" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-cluster-autopilot"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-cluster-autopilot?ref=v30.0.0&depth=1"
count = local.cluster_create && var.gke_autopilot ? 1 : 0
project_id = module.project.project_id
name = var.cluster_name
Expand Down Expand Up @@ -178,7 +174,7 @@ module "cluster-autopilot" {
}

module "cluster-nodepool" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-nodepool"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-nodepool?ref=v30.0.0&depth=1"
depends_on = [module.cluster-standard]
for_each = (local.cluster_create && !var.gke_autopilot) ? var.nodepools : tomap({})

Expand Down
10 changes: 5 additions & 5 deletions benchmarks/infra/stage-1/modules/gke-infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ locals {
}

module "project" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/project"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/project?ref=v30.0.0&depth=1"
parent = try(var.project_create.parent, null)
billing_account = try(var.project_create.billing_account, null)
name = var.project_id
Expand Down Expand Up @@ -125,14 +125,14 @@ module "vpc" {
}

module "fleet-project" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/project"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/project?ref=v30.0.0&depth=1"
count = var.fleet_project_id == null ? 0 : 1
name = var.fleet_project_id
project_create = false
}

module "fleet" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-hub"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/gke-hub?ref=v30.0.0&depth=1"
project_id = local.fleet_project.project_id
clusters = {
(var.cluster_name) = (
Expand All @@ -144,7 +144,7 @@ module "fleet" {
}

module "registry" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/artifact-registry"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/artifact-registry?ref=v30.0.0&depth=1"
count = var.registry_create ? 1 : 0
project_id = module.project.project_id
location = var.region
Expand All @@ -153,7 +153,7 @@ module "registry" {
}

module "nat" {
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/net-cloudnat"
source = "git::https://github.com/GoogleCloudPlatform/cloud-foundation-fabric.git//modules/net-cloudnat?ref=v30.0.0&depth=1"
count = local.create_nat ? 1 : 0
project_id = module.project.project_id
region = var.region
Expand Down

0 comments on commit bd4d7d4

Please sign in to comment.