diff --git a/.changelog/9881.txt b/.changelog/9881.txt new file mode 100644 index 00000000000..5987005addf --- /dev/null +++ b/.changelog/9881.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +compute: added `enabled` field to `compute_backend_service.iap` resource (revert) +``` \ No newline at end of file diff --git a/google/services/compute/resource_compute_backend_service.go b/google/services/compute/resource_compute_backend_service.go index b94f99306a4..01905da2771 100644 --- a/google/services/compute/resource_compute_backend_service.go +++ b/google/services/compute/resource_compute_backend_service.go @@ -636,22 +636,14 @@ For internal load balancing, a URL to a HealthCheck resource must be specified i MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "enabled": { - Type: schema.TypeBool, - Computed: true, - Optional: true, - Description: `Whether the serving infrastructure will authenticate and authorize all incoming requests.`, - }, "oauth2_client_id": { Type: schema.TypeString, - Computed: true, - Optional: true, + Required: true, Description: `OAuth2 Client ID for IAP`, }, "oauth2_client_secret": { Type: schema.TypeString, - Computed: true, - Optional: true, + Required: true, Description: `OAuth2 Client Secret for IAP`, Sensitive: true, }, @@ -2730,8 +2722,6 @@ func flattenComputeBackendServiceIap(v interface{}, d *schema.ResourceData, conf flattenComputeBackendServiceIapOauth2ClientSecret(original["oauth2ClientSecret"], d, config) transformed["oauth2_client_secret_sha256"] = flattenComputeBackendServiceIapOauth2ClientSecretSha256(original["oauth2ClientSecretSha256"], d, config) - transformed["enabled"] = - flattenComputeBackendServiceIapEnabled(original["enabled"], d, config) return []interface{}{transformed} } func flattenComputeBackendServiceIapOauth2ClientId(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { @@ -2746,10 +2736,6 @@ func flattenComputeBackendServiceIapOauth2ClientSecretSha256(v interface{}, d *s return v } -func flattenComputeBackendServiceIapEnabled(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenComputeBackendServiceLoadBalancingScheme(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } @@ -3856,13 +3842,6 @@ func expandComputeBackendServiceIap(v interface{}, d tpgresource.TerraformResour transformed["oauth2ClientSecretSha256"] = transformedOauth2ClientSecretSha256 } - transformedEnabled, err := expandComputeBackendServiceIapEnabled(original["enabled"], d, config) - if err != nil { - return nil, err - } else if val := reflect.ValueOf(transformedEnabled); val.IsValid() && !tpgresource.IsEmptyValue(val) { - transformed["enabled"] = transformedEnabled - } - return transformed, nil } @@ -3878,10 +3857,6 @@ func expandComputeBackendServiceIapOauth2ClientSecretSha256(v interface{}, d tpg return v, nil } -func expandComputeBackendServiceIapEnabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} - func expandComputeBackendServiceLoadBalancingScheme(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil } diff --git a/google/services/compute/resource_compute_backend_service_test.go b/google/services/compute/resource_compute_backend_service_test.go index d73be293c05..33a73da21cb 100644 --- a/google/services/compute/resource_compute_backend_service_test.go +++ b/google/services/compute/resource_compute_backend_service_test.go @@ -144,15 +144,6 @@ func TestAccComputeBackendService_withBackendAndIAP(t *testing.T) { ImportState: true, ImportStateVerify: true, }, - { - Config: testAccComputeBackendService_withBackendAndIAP_enabled( - serviceName, igName, itName, checkName, 10), - }, - { - ResourceName: "google_compute_backend_service.lipsum", - ImportState: true, - ImportStateVerify: true, - }, }, }) } @@ -1167,67 +1158,6 @@ resource "google_compute_http_health_check" "default" { `, serviceName, timeout, igName, itName, checkName) } -func testAccComputeBackendService_withBackendAndIAP_enabled( - serviceName, igName, itName, checkName string, timeout int64) string { - return fmt.Sprintf(` -data "google_compute_image" "my_image" { - family = "debian-11" - project = "debian-cloud" -} - -resource "google_compute_backend_service" "lipsum" { - name = "%s" - description = "Hello World 1234" - port_name = "http" - protocol = "HTTP" - timeout_sec = %v - - backend { - group = google_compute_instance_group_manager.foobar.instance_group - } - - iap { - enabled = true - } - - health_checks = [google_compute_http_health_check.default.self_link] -} - -resource "google_compute_instance_group_manager" "foobar" { - name = "%s" - version { - instance_template = google_compute_instance_template.foobar.self_link - name = "primary" - } - base_instance_name = "tf-test-foobar" - zone = "us-central1-f" - target_size = 1 -} - -resource "google_compute_instance_template" "foobar" { - name = "%s" - machine_type = "e2-medium" - - network_interface { - network = "default" - } - - disk { - source_image = data.google_compute_image.my_image.self_link - auto_delete = true - boot = true - } -} - -resource "google_compute_http_health_check" "default" { - name = "%s" - request_path = "/" - check_interval_sec = 1 - timeout_sec = 1 -} -`, serviceName, timeout, igName, itName, checkName) -} - func testAccComputeBackendService_withSessionAffinity(serviceName, checkName, description, affinityName string) string { return fmt.Sprintf(` resource "google_compute_backend_service" "foobar" { diff --git a/website/docs/r/compute_backend_service.html.markdown b/website/docs/r/compute_backend_service.html.markdown index 1a4fe566b4c..ecab112800a 100644 --- a/website/docs/r/compute_backend_service.html.markdown +++ b/website/docs/r/compute_backend_service.html.markdown @@ -901,11 +901,11 @@ The following arguments are supported: The `iap` block supports: * `oauth2_client_id` - - (Optional) + (Required) OAuth2 Client ID for IAP * `oauth2_client_secret` - - (Optional) + (Required) OAuth2 Client Secret for IAP **Note**: This property is sensitive and will not be displayed in the plan. @@ -914,10 +914,6 @@ The following arguments are supported: OAuth2 Client Secret SHA-256 for IAP **Note**: This property is sensitive and will not be displayed in the plan. -* `enabled` - - (Optional) - Whether the serving infrastructure will authenticate and authorize all incoming requests. - The `locality_lb_policies` block supports: * `policy` -