Skip to content

Commit

Permalink
Remove sending empty oauth2ClientId and oauth2ClientSecret string for…
Browse files Browse the repository at this point in the history
… null IAP message in google_compute_region_backend_service (GoogleCloudPlatform#9851)

* Remove default addition of oauth2ClientId and oauth2ClientSecret in google_compute_region_backend_service

* Remove default addition of oauth2ClientId and oauth2ClientSecret in google_compute_backend_service
  • Loading branch information
arnabadg-google authored Jan 22, 2024
1 parent 003fa68 commit 682308d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
7 changes: 7 additions & 0 deletions mmv1/products/compute/BackendService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ examples:
vars:
backend_service_name: 'backend-service'
http_health_check_name: 'health-check'
- !ruby/object:Provider::Terraform::Examples
name: 'backend_service_external_iap'
primary_resource_id: 'default'
vars:
backend_service_name: 'tf-test-backend-service-external'
ignore_read_extra:
- 'iap.0.oauth2_client_secret'
- !ruby/object:Provider::Terraform::Examples
name: 'backend_service_cache_simple'
primary_resource_id: 'default'
Expand Down
7 changes: 7 additions & 0 deletions mmv1/products/compute/RegionBackendService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ examples:
vars:
region_backend_service_name: 'region-service'
health_check_name: 'rbs-health-check'
- !ruby/object:Provider::Terraform::Examples
name: 'region_backend_service_external_iap'
primary_resource_id: 'default'
vars:
region_backend_service_name: 'tf-test-region-service-external'
ignore_read_extra:
- 'iap.0.oauth2_client_secret'
- !ruby/object:Provider::Terraform::Examples
name: 'region_backend_service_cache'
primary_resource_id: 'default'
Expand Down
2 changes: 0 additions & 2 deletions mmv1/templates/terraform/encoders/backend_service.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ iapVal := obj["iap"]
if iapVal == nil {
data := map[string]interface{}{}
data["enabled"] = false
data["oauth2ClientId"] = ""
data["oauth2ClientSecret"] = ""
obj["iap"] = data
} else {
iap := iapVal.(map[string]interface{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ iapVal := obj["iap"]
if iapVal == nil {
data := map[string]interface{}{}
data["enabled"] = false
data["oauth2ClientId"] = ""
data["oauth2ClientSecret"] = ""
obj["iap"] = data
} else {
iap := iapVal.(map[string]interface{})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "google_compute_backend_service" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['backend_service_name'] %>"
protocol = "HTTP"
load_balancing_scheme = "EXTERNAL"
iap {
oauth2_client_id = "abc"
oauth2_client_secret = "xyz"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "google_compute_region_backend_service" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['region_backend_service_name'] %>"
region = "us-central1"
protocol = "HTTP"
load_balancing_scheme = "EXTERNAL"
iap {
oauth2_client_id = "abc"
oauth2_client_secret = "xyz"
}
}

0 comments on commit 682308d

Please sign in to comment.