Skip to content

Commit

Permalink
Merge pull request #11901 from rifelpet/tf-project
Browse files Browse the repository at this point in the history
Include GCP Project in terraform HCL2 output
  • Loading branch information
k8s-ci-robot committed Jul 1, 2021
2 parents fe8c26f + 13f4305 commit b8aa684
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 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 = "testproject"
region = "us-test1"
}

resource "aws_s3_bucket_object" "cluster-completed-spec" {
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 = "testproject"
region = "us-test1"
}

resource "aws_s3_bucket_object" "cluster-completed-spec" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ output "region" {
}

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

resource "aws_s3_bucket_object" "cluster-completed-spec" {
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 @@ -44,6 +44,9 @@ func (t *TerraformTarget) finishHCL2() 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 b8aa684

Please sign in to comment.