Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit 78b8e1d

Browse files
authored
feat: convert Terraform configuration from plain files to modules (#1054)
Replace 'loging' with 'login' in tutorial and README instructions and adds "create" command in markdown. (#1047) Fixes errors (#1045) and refactors use of kustomize path in CLI. Makes GKE+ASM provisioning a module. Makes Online Boutique provisioning a module. Creates a new 'main.tf' TF configuration to provision modules sequentially, because of the hard dependency there is no effective way to paralelize it. Refactors "online-boutique" to replace with "microservices-demo".
1 parent ee46c8f commit 78b8e1d

File tree

24 files changed

+237
-107
lines changed

24 files changed

+237
-107
lines changed
File renamed without changes.

provisioning/sandboxctl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ SCRIPT_DIR="$(realpath "$(dirname "${0}")")"; readonly SCRIPT_DIR
3333
SANDBOX_VERSION="$(tr -d '\n' < "${SCRIPT_DIR}/version.txt")"; readonly SANDBOX_VERSION
3434
SANDBOX_SESSION="${SANDBOX_SESSION:-$(python3 -c 'import uuid; print(uuid.uuid4())')}"; readonly SANDBOX_SESSION
3535
CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY="${CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY:-}"; readonly CLOUD_OPS_SANDBOX_DISABLE_TELEMETRY
36+
MICROSERVICE_DEMO_PATH="/kustomize/microservices-demo/"; readonly MICROSERVICE_DEMO_PATH
3637
AGCLOUD=""
3738
ATERRAFORM=""
3839

@@ -472,7 +473,7 @@ configure_terraform_input_vars() {
472473
state_bucket_name = "${TF_BUCKET_NAME}"
473474
state_prefix = "${TERRAFORM_PREFIX}"
474475
gcp_project_id = "${PROJECT_ID}"
475-
filepath_manifest = "${SCRIPT_DIR}/kustomize/online-boutique/"
476+
filepath_manifest = "${SCRIPT_DIR}${MICROSERVICE_DEMO_PATH}"
476477
EOF
477478
)
478479

@@ -494,7 +495,7 @@ EOF
494495
}
495496

496497
configure_kustomization() {
497-
KUSTOMIZE_FILE="${SCRIPT_DIR}/kustomize/online-boutique/kustomization.yaml"; readonly KUSTOMIZE_FILE
498+
KUSTOMIZE_FILE="${SCRIPT_DIR}${MICROSERVICE_DEMO_PATH}kustomization.yaml"; readonly KUSTOMIZE_FILE
498499
cp "${KUSTOMIZE_FILE}" "${KUSTOMIZE_FILE}.origin" > /dev/null
499500
local SED_EXPRESSION; SED_EXPRESSION=""
500501

provisioning/terraform/asm.tf

Lines changed: 0 additions & 48 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

provisioning/terraform/monitoring/slo_services.tf renamed to provisioning/terraform/cloud-ops/slo_services.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,15 @@ resource "google_monitoring_slo" "service_latency" {
112112
]
113113
}
114114

115+
data "google_project" "info" {
116+
project_id = var.gcp_project_id
117+
}
118+
115119
module "slo_service" {
116120
count = length(local.slo_services)
117121
source = "./slo_service"
118122

119-
project_number = var.gcp_project_number
123+
project_number = data.google_project.info.number
120124
name = local.slo_services[count.index].id
121125
}
122126

0 commit comments

Comments
 (0)