Skip to content
Merged
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
3 changes: 3 additions & 0 deletions examples/with-backstage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Once you are finished with the reference architecture, you can remove all provis
| github | ~> 5.38 |
| google | ~> 5.1 |
| humanitec | ~> 0.13 |
| random | ~> 3.5 |

### Providers

Expand All @@ -84,6 +85,7 @@ Once you are finished with the reference architecture, you can remove all provis
| github | ~> 5.38 |
| google | ~> 5.1 |
| humanitec | ~> 0.13 |
| random | ~> 3.5 |

### Modules

Expand Down Expand Up @@ -120,6 +122,7 @@ Once you are finished with the reference architecture, you can remove all provis
| [humanitec_value.backstage_github_org_id](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/value) | resource |
| [humanitec_value.backstage_humanitec_org](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/value) | resource |
| [humanitec_value.backstage_humanitec_token](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/value) | resource |
| [random_string.oidc_suffix](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |

### Inputs

Expand Down
10 changes: 8 additions & 2 deletions examples/with-backstage/gcp-github.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ locals {
cloud_provider = "gcp"
}

resource "random_string" "oidc_suffix" {
length = 6
special = false
upper = false
}

# Create a role for GitHub Actions to push to GAR using OpenID Connect (OIDC) so we don't need to store GCP credentials in GitHub
# Reference https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-google-cloud-platform

Expand All @@ -12,8 +18,8 @@ module "gh_oidc" {
source = "terraform-google-modules/github-actions-runners/google//modules/gh-oidc"
version = "~> 3.1"
project_id = var.project_id
pool_id = "htc-ref-arch"
provider_id = "htc-ref-arch"
pool_id = "htc-ref-arch-${resource.random_string.oidc_suffix.result}"
provider_id = "htc-ref-arch-${resource.random_string.oidc_suffix.result}"
attribute_mapping = {
"google.subject" = "assertion.sub"
"attribute.actor" = "assertion.actor"
Expand Down
4 changes: 4 additions & 0 deletions examples/with-backstage/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ terraform {
source = "integrations/github"
version = "~> 5.38"
}
random = {
source = "hashicorp/random"
version = "~> 3.5"
}
}
required_version = ">= 1.3.0"
}
Expand Down