Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7fddaa3
Starting to add in db.
bgood Jun 2, 2025
b192cb6
Create cloudbuild.yaml
prev-dev Jun 11, 2025
71a9b45
Fixing the default AR Repo to align with the default value from Terra…
bgood Jun 12, 2025
a1d1baf
Adding resource to create an ssl cert.
bgood Jun 17, 2025
6253c3c
some fixes from testing.
bgood Jun 17, 2025
fb30977
Organizing and adding in manifests.
bgood Jun 18, 2025
30f9f0d
Cleaning up headers.
bgood Jun 18, 2025
7416259
back merging in changes from debugging.
bgood Jul 7, 2025
f4234b1
fixing issues found in testing up to terraform plan
bgood Jul 8, 2025
d285457
Migrating over more fixes and documenation updates from testing.
bgood Jul 8, 2025
b23fb4d
Cleaning up linting errors.
bgood Jul 8, 2025
a64f84d
Merge remote-tracking branch 'origin/main' into backstage-qs-updates-2
bgood Jul 8, 2025
7a14133
chore: update documentation site
bgood Jul 8, 2025
a9a87e6
Fixing a typo in the gke credentials command.
bgood Jul 9, 2025
2231a71
chore: update documentation site
bgood Jul 9, 2025
4ab6ef5
Alphabetizing and adding the iam api.
bgood Jul 9, 2025
cbd50b4
Fixes for the IAP brand Terraform resource deprecation.
bgood Jul 9, 2025
de7a4b7
chore: update documentation site
bgood Jul 9, 2025
2990356
Fixing the list numbers.
bgood Jul 9, 2025
4007578
.... and tf format.
bgood Jul 9, 2025
dd3d42b
Linter.
bgood Jul 10, 2025
5619e2a
First cut at the IAP auth provider.
bgood Jul 10, 2025
2959ff6
linter
bgood Jul 10, 2025
56beb37
chore: update documentation site
bgood Jul 10, 2025
9622b81
Fixes from testing and handling of the IAP Client resource deprecation.
bgood Jul 11, 2025
02c82e0
Linter run.
bgood Jul 11, 2025
6db1d11
chore: update documentation site
bgood Jul 11, 2025
520eb76
Adding feedback from Ameenah.
bgood Jul 16, 2025
76c503b
chore: update documentation site
bgood Jul 16, 2025
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
234 changes: 164 additions & 70 deletions docs/reference-architectures/backstage/backstage-quickstart/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/search/search_index.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,78 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/code-of-conduct/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/contributing/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/accelerating-migrations/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/automated-password-rotation/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/backstage/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/backstage/backstage-quickstart/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/cloud_deploy_flow/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/cloud_deploy_flow/CloudFunctions/cloudDeployApprovals/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/cloud_deploy_flow/CloudFunctions/cloudDeployInteractions/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/cloud_deploy_flow/CloudFunctions/cloudDeployOperations/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/cloud_deploy_flow/CloudFunctions/createRelease/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/cloud_deploy_flow/CloudRun/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/cloud_deploy_flow/WebsiteDemo/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/github-runners-gke/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/sandboxes/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/sandboxes/examples/cli/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/sandboxes/examples/gcp-sandboxes/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
<url>
<loc>https://googlecloudplatform.github.io/platform-engineering/reference-architectures/sandboxes/sandbox-modules/</loc>
<lastmod>2025-06-18</lastmod>
<lastmod>2025-07-16</lastmod>
</url>
</urlset>
Binary file modified docs/sitemap.xml.gz
Binary file not shown.
145 changes: 133 additions & 12 deletions reference-architectures/backstage/backstage-quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ In this section you prepare your project for deployment.
gcloud storage buckets create gs://${BACKSTAGE_QS_STATE_BUCKET} --project ${PROJECT_ID}
```

3. Set the configuration variables

```bash
sed -i "s/YOUR_STATE_BUCKET/${BACKSTAGE_QS_STATE_BUCKET}/g" ${BACKSTAGE_QS_BASE_DIR}/backend.tf
sed -i "s/YOUR_PROJECT_ID/${PROJECT_ID}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
sed -i "s/YOUR_IAP_USER_DOMAIN/${IAP_USER_DOMAIN}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
sed -i "s/YOUR_IAP_SUPPORT_EMAIL/${IAP_SUPPORT_EMAIL}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
```

## Deploy Backstage

Before running Terraform, make sure that the Service Usage API and Service
Expand All @@ -103,11 +94,59 @@ Management API are enabled.
1. Enable Service Usage API and Service Management API

```bash
gcloud services enable serviceusage.googleapis.com \
gcloud services enable servicemanagement.googleapis.com
gcloud services enable \
cloudresourcemanager.googleapis.com \
iap.googleapis.com \
serviceusage.googleapis.com \
servicemanagement.googleapis.com
```

2. Setup the Identity Aware Proxy brand

```bash
gcloud iap oauth-brands create \
--application_title="IAP Secured Backstage" \
--project="${PROJECT_ID}" \
--support_email="${IAP_SUPPORT_EMAIL}"
```

Capture the brand name in an environment variable, it will be in the format
of: `projects/[your_project_number]/brands/[your_project_number]`.

```bash
export IAP_BRAND=<your_brand_name>
```

3. Using the brand name create the IAP client.

```bash
gcloud iap oauth-clients create \
${IAP_BRAND} \
--display_name="IAP Secured Backstage"
```

Capture the client_id and client_secret in environment variables. For the
client_id we only need the last value of the string, it will be in the
format of:
`549085115274-ksi3n9n41tp1vif79dda5ofauk0ebes9.apps.googleusercontent.com`

```bash
export IAP_CLIENT_ID="<your_client_id>"
export IAP_SECRET="<your_iap_secret>"
```

4. Set the configuration variables

```bash
sed -i "s/YOUR_STATE_BUCKET/${BACKSTAGE_QS_STATE_BUCKET}/g" ${BACKSTAGE_QS_BASE_DIR}/backend.tf
sed -i "s/YOUR_PROJECT_ID/${PROJECT_ID}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
sed -i "s/YOUR_IAP_USER_DOMAIN/${IAP_USER_DOMAIN}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
sed -i "s/YOUR_IAP_SUPPORT_EMAIL/${IAP_SUPPORT_EMAIL}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
sed -i "s/YOUR_IAP_CLIENT_ID/${IAP_CLIENT_ID}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
sed -i "s/YOUR_IAP_SECRET/${IAP_SECRET}/g" ${BACKSTAGE_QS_BASE_DIR}/backstage-qs.auto.tfvars
```

2. Create the resources
5. Create the resources

```bash
cd ${BACKSTAGE_QS_BASE_DIR} && \
Expand All @@ -117,9 +156,91 @@ Management API are enabled.
rm tfplan
```

Initial run of the Terraform may result in errors due to they way the API
services are asyrchonously enabled. Re-running the terraform usually
resolves the errors.

This will take a while to create all of the required resources, figure
somewhere between 15 and 20 minutes.

6. Build the container image for Backstage

```bash
cd manifests/cloudbuild
gcloud builds submit .
```

The output of that command will include a fully qualified image path similar
to:
`us-central1-docker.pkg.dev/[your_project]/backstage-qs/backstage-quickstart:d747db2a-deef-4783-8a0e-3b36e568f6fc`
Using that value create a new environment variable.

```bash
export IMAGE_PATH="<your_image_path>"
```

This will take approximately 10 minutes to build and push the image.

7. Configure Cloud SQL postgres user for password authentication.

```bash
gcloud sql users set-password postgres --instance=backstage-qs --prompt-for-password
```

8. Grant the backstage workload service account create database permissions.

a. In the Cloud Console, navigate to `SQL`

b. Select the database instance

c. In the left menu select `Cloud SQL Studio`

d. Choose the `postgres` database and login with the `postgres` user and
password you created in step 4.

e. Run the following sql commands, to grant create database permissions

```sql
ALTER USER "backstage-qs-workload@[your_project_id].iam" CREATEDB
```

9. Perform an initial deployment of Kubernetes resources.

```bash
cd ../k8s
sed -i "s%CONTAINER_IMAGE%${IMAGE_PATH}%g" deployment.yaml
gcloud container clusters get-credentials backstage-qs --region us-central1 --dns-endpoint
kubectl apply -f .
```

10. Capture the IAP audience, the Backend Service may take a few minutes to
appear.

a. In the Cloud Console, navigate to `Security` > `Identity-Aware Proxy`

b. Verify the IAP option is set to enabled. If not enable it now.

b. Choose `Get JWT audience code` from the three dot menu on the right side
of your Backend Service.

c. The value will be in the format of:
`/projects/<your_project_number>/global/backendServices/<numeric_id>`. Using
that value create a new environment variable.

```bash
export IAP_AUDIENCE_VALUE="<your_iap_audience_value>"
```

11. Redeploy the Kubernetes manifests with the IAP audience

```bash
sed -i "s%IAP_AUDIENCE_VALUE%${IAP_AUDIENCE_VALUE}%g" deployment.yaml
kubectl apply -f .
```

12. In a browser navigate to you backstage endpoint. The URL will be similar to
`https://qs.endpoints.[your_project_id].cloud.goog`

## Cleanup

1. Destroy the resources using Terraform destroy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
environment_name = "qs"
iap_user_domain = "YOUR_IAP_USER_DOMAIN"
iap_support_email = "YOUR_IAP_SUPPORT_EMAIL"
iap_client_id = "YOUR_IAP_CLIENT_ID"
iap_client_secret = "YOUR_IAP_SECRET"
environment_project_id = "YOUR_PROJECT_ID"
23 changes: 23 additions & 0 deletions reference-architectures/backstage/backstage-quickstart/db.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,29 @@ resource "google_sql_database_instance" "instance" {
psc_enabled = true
allowed_consumer_projects = [var.environment_project_id]
}
ssl_mode = "ENCRYPTED_ONLY"
}
}
timeouts {
create = "30m"
update = "30m"
delete = "30m"
}
}

resource "google_sql_database" "database" {
name = "backstage"
instance = google_sql_database_instance.instance.name
}

resource "google_sql_user" "iam_service_account_user" {
# Note: for Postgres only, GCP requires omitting the ".gserviceaccount.com" suffix
# from the service account email due to length limits on database usernames.

name = trimsuffix(google_service_account.workloadSa.email, ".gserviceaccount.com")
instance = google_sql_database_instance.instance.name
type = "CLOUD_IAM_SERVICE_ACCOUNT"
}

resource "null_resource" "sqlIamDelay" {
provisioner "local-exec" {
Expand All @@ -50,3 +63,13 @@ resource "null_resource" "sqlIamDelay" {
"before" = "${google_sql_database_instance.instance.id}"
}
}

resource "local_file" "app_config_production_yaml" {
content = templatefile(
"${path.module}/manifests/templates/app-config.production.tftpl.yaml",
{
endpoint_url = local.backstageExternalUrl
}
)
filename = "${path.module}/manifests/cloudbuild/app-config.production.yaml"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ locals {

resource "google_endpoints_service" "backstageQsEndpoint" {
openapi_config = templatefile(
"${path.module}/backstage-qs-endpoint-spec-tftpl.yaml",
"${path.module}/manifests/templates/backstage-qs-endpoint-spec-tftpl.yaml",
{
endpoint = local.backstageExternalUrl,
ip_address = google_compute_global_address.backstageQsEndpointAddress.address
Expand All @@ -27,3 +27,11 @@ resource "google_endpoints_service" "backstageQsEndpoint" {
project = var.environment_project_id
service_name = local.backstageExternalUrl
}

resource "google_compute_managed_ssl_certificate" "backstageCert" {
name = "backstage-qs-cert"

managed {
domains = [local.backstageExternalUrl]
}
}
2 changes: 0 additions & 2 deletions reference-architectures/backstage/backstage-quickstart/gke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ resource "google_container_cluster" "hostingCluster" {
}
}


logging_config {
enable_components = ["SYSTEM_COMPONENTS", "WORKLOADS"]
}
Expand Down Expand Up @@ -64,5 +63,4 @@ resource "google_container_cluster" "hostingCluster" {
update = "30m"
delete = "30m"
}

}
Loading