Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SHARED_LOADBALANCER_VIP purpose to regional addresses. #7987

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4169.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: added SHARED_LOADBALANCER_VIP as a valid option for `google_compute_address.purpose`
```
8 changes: 6 additions & 2 deletions google/resource_compute_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ specified, it is assumed to be PREMIUM. Possible values: ["PREMIUM", "STANDARD"]
Computed: true,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"GCE_ENDPOINT", ""}, false),
ValidateFunc: validation.StringInSlice([]string{"GCE_ENDPOINT", "VPC_PEERING", "SHARED_LOADBALANCER_VIP", ""}, false),
Description: `The purpose of this resource, which can be one of the following values:

* GCE_ENDPOINT for addresses that are used by VM instances, alias IP ranges, internal load balancers, and similar resources.

This should only be set when using an Internal address. Possible values: ["GCE_ENDPOINT"]`,
* SHARED_LOADBALANCER_VIP for an address that can be used by multiple internal load balancers.

* VPC_PEERING for addresses that are reserved for VPC peer networks.

This should only be set when using an Internal address. Possible values: ["GCE_ENDPOINT", "VPC_PEERING", "SHARED_LOADBALANCER_VIP"]`,
},
"region": {
Type: schema.TypeString,
Expand Down
38 changes: 38 additions & 0 deletions google/resource_compute_address_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,44 @@ resource "google_compute_address" "internal_with_gce_endpoint" {
`, context)
}

func TestAccComputeAddress_addressWithSharedLoadbalancerVipExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
ExternalProviders: map[string]resource.ExternalProvider{
"random": {},
},
CheckDestroy: testAccCheckComputeAddressDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccComputeAddress_addressWithSharedLoadbalancerVipExample(context),
},
{
ResourceName: "google_compute_address.internal_with_shared_loadbalancer_vip",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"subnetwork", "region"},
},
},
})
}

func testAccComputeAddress_addressWithSharedLoadbalancerVipExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_compute_address" "internal_with_shared_loadbalancer_vip" {
name = "tf-test-my-internal-address%{random_suffix}"
address_type = "INTERNAL"
purpose = "SHARED_LOADBALANCER_VIP"
}
`, context)
}

func TestAccComputeAddress_instanceWithIpExample(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/compute_address.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ The following arguments are supported:
The purpose of this resource, which can be one of the following values:
* GCE_ENDPOINT for addresses that are used by VM instances, alias IP ranges, internal load balancers, and similar resources.
* SHARED_LOADBALANCER_VIP for an address that can be used by multiple internal load balancers.
* VPC_PEERING for addresses that are reserved for VPC peer networks.
This should only be set when using an Internal address.
Possible values are `GCE_ENDPOINT` and `SHARED_LOADBALANCER_VIP`.
Possible values are `GCE_ENDPOINT`, `VPC_PEERING`, and `SHARED_LOADBALANCER_VIP`.

* `network_tier` -
(Optional)
Expand Down