Skip to content

Commit

Permalink
Correct SecurityGateway to be global only (#12788) (#21006)
Browse files Browse the repository at this point in the history
[upstream:03f66203c207e3b0629fdf731d2f8e1e30c011fe]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jan 22, 2025
1 parent 1d5beef commit 19daf0c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .changelog/12788.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:bug
beyondcorp: corrected `location` to always be global in `google_beyondcorp_security_gateway`
```
```release-note:deprecation
beyondcorp: deprecated `location` on `google_beyondcorp_security_gateway`. The only valid value is `global`, which is now also the default value. The field will be removed in a future major release.
```
16 changes: 10 additions & 6 deletions google/services/beyondcorp/resource_beyondcorp_security_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (

"github.com/hashicorp/terraform-provider-google/google/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
"github.com/hashicorp/terraform-provider-google/google/verify"
)

func ResourceBeyondcorpSecurityGateway() *schema.Resource {
Expand All @@ -54,12 +55,6 @@ func ResourceBeyondcorpSecurityGateway() *schema.Resource {
),

Schema: map[string]*schema.Schema{
"location": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `Resource ID segment making up resource 'name'. It identifies the resource within its parent collection as described in https://google.aip.dev/122.`,
},
"security_gateway_id": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -107,6 +102,15 @@ as a key.`,
},
},
},
"location": {
Type: schema.TypeString,
Optional: true,
Deprecated: "`location` is deprecated and will be removed in a future major release.",
ForceNew: true,
ValidateFunc: verify.ValidateRegexp(`^global$`),
Description: `Resource ID segment making up resource 'name'. It identifies the resource within its parent collection as described in https://google.aip.dev/122. Must be omitted or set to 'global'.`,
Default: "global",
},
"create_time": {
Type: schema.TypeString,
Computed: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func testAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample(cont
return acctest.Nprintf(`
resource "google_beyondcorp_security_gateway" "example" {
security_gateway_id = "default%{random_suffix}"
location = "global"
display_name = "My Security Gateway resource"
hubs { region = "us-central1" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_upda
ResourceName: "google_beyondcorp_security_gateway.example",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "security_gateway_id"},
ImportStateVerifyIgnore: []string{"security_gateway_id"},
},
{
Config: testAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_update(context),
Expand All @@ -43,7 +43,7 @@ func TestAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_upda
ResourceName: "google_beyondcorp_security_gateway.example",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "security_gateway_id"},
ImportStateVerifyIgnore: []string{"security_gateway_id"},
},
},
})
Expand All @@ -53,7 +53,6 @@ func testAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_basi
return acctest.Nprintf(`
resource "google_beyondcorp_security_gateway" "example" {
security_gateway_id = "default%{random_suffix}"
location = "global"
display_name = "My Security Gateway resource"
hubs { region = "us-central1" }
}
Expand All @@ -64,7 +63,6 @@ func testAccBeyondcorpSecurityGateway_beyondcorpSecurityGatewayBasicExample_upda
return acctest.Nprintf(`
resource "google_beyondcorp_security_gateway" "example" {
security_gateway_id = "default%{random_suffix}"
location = "global"
display_name = "My Security Gateway resource"
hubs { region = "us-east1" }
}
Expand Down
11 changes: 6 additions & 5 deletions website/docs/r/beyondcorp_security_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Deployment of Security Gateway.
```hcl
resource "google_beyondcorp_security_gateway" "example" {
security_gateway_id = "default"
location = "global"
display_name = "My Security Gateway resource"
hubs { region = "us-central1" }
}
Expand All @@ -45,10 +44,6 @@ resource "google_beyondcorp_security_gateway" "example" {
The following arguments are supported:


* `location` -
(Required)
Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.

* `security_gateway_id` -
(Required)
Optional. User-settable SecurityGateway resource ID.
Expand All @@ -71,6 +66,12 @@ The following arguments are supported:
Optional. An arbitrary user-provided name for the SecurityGateway.
Cannot exceed 64 characters.

* `location` -
(Optional, Deprecated)
Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. Must be omitted or set to `global`.

~> **Warning:** `location` is deprecated and will be removed in a future major release.

* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.

Expand Down

0 comments on commit 19daf0c

Please sign in to comment.