Skip to content

Commit

Permalink
Revert "add enabled boolean field to `compute_backend_service.iap
Browse files Browse the repository at this point in the history
… resource" (#9881) (#6908)

[upstream:6f8577bea31cf5e4a66c3cf35c731fcfc3318b11]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored and roaks3 committed Jan 26, 2024
1 parent e0a698f commit a55a50a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 103 deletions.
3 changes: 3 additions & 0 deletions .changelog/9881.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: added `enabled` field to `compute_backend_service.iap` resource (revert)
```
29 changes: 2 additions & 27 deletions google-beta/services/compute/resource_compute_backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,22 +661,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,
},
Expand Down Expand Up @@ -2806,8 +2798,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{} {
Expand All @@ -2822,10 +2812,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
}
Expand Down Expand Up @@ -3973,13 +3959,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
}

Expand All @@ -3995,10 +3974,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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
})
}
Expand Down Expand Up @@ -1310,67 +1301,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" {
Expand Down
8 changes: 2 additions & 6 deletions website/docs/r/compute_backend_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -901,11 +901,11 @@ The following arguments are supported:
<a name="nested_iap"></a>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.

Expand All @@ -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.

<a name="nested_locality_lb_policies"></a>The `locality_lb_policies` block supports:

* `policy` -
Expand Down

0 comments on commit a55a50a

Please sign in to comment.