Skip to content

Commit

Permalink
Merge pull request #11903 from rifelpet/automated-cherry-pick-of-#119…
Browse files Browse the repository at this point in the history
…01-origin-release-1.20

Automated cherry pick of #11901: Include GCP Project in terraform HCL2 output
  • Loading branch information
k8s-ci-robot committed Jul 1, 2021
2 parents 159943e + 3c1cc72 commit 5b9ef9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/integration/update_cluster/ha_gce/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ output "region" {
}

provider "google" {
region = "us-test1"
project = "us-test1"
region = "us-test1"
}

resource "google_compute_disk" "d1-etcd-events-ha-gce-example-com" {
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/update_cluster/minimal_gce/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ output "region" {
}

provider "google" {
region = "us-test1"
project = "us-test1"
region = "us-test1"
}

resource "google_compute_disk" "d1-etcd-events-minimal-gce-example-com" {
Expand Down
3 changes: 3 additions & 0 deletions upup/pkg/fi/cloudup/terraform/target_hcl2.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func (t *TerraformTarget) finishHCL2(taskMap map[string]fi.Task) error {
}
providerBlock := rootBody.AppendNewBlock("provider", []string{providerName})
providerBody := providerBlock.Body()
if t.Cloud.ProviderID() == kops.CloudProviderGCE {
providerBody.SetAttributeValue("project", cty.StringVal(t.Project))
}
providerBody.SetAttributeValue("region", cty.StringVal(t.Cloud.Region()))
for k, v := range tfGetProviderExtraConfig(t.clusterSpecTarget) {
providerBody.SetAttributeValue(k, cty.StringVal(v))
Expand Down

0 comments on commit 5b9ef9b

Please sign in to comment.