Skip to content

Commit

Permalink
Merge 079107a into b8e309a
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisst authored Sep 21, 2018
2 parents b8e309a + 079107a commit e2c7b45
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
42 changes: 42 additions & 0 deletions products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,48 @@ objects:
description: |
A reference to the region where the regional address resides.
output: true
- !ruby/object:Api::Type::Integer
name: 'prefixLength'
description: |
The prefix length of the IP range. If not present, it means the
address field is a single IP address.
This field is not applicable to addresses with addressType=EXTERNAL.
min_version: beta
- !ruby/object:Api::Type::Enum
name: 'addressType'
description: |
The type of the address to reserve, default is EXTERNAL.
* EXTERNAL indicates public/external single IP address.
* INTERNAL indicates internal IP ranges belonging to some network.
values:
- :EXTERNAL
- :INTERNAL
default_value: :EXTERNAL
min_version: beta
- !ruby/object:Api::Type::Enum
name: 'purpose'
description: |
The purpose of the resource. For global internal addresses it can be
* VPC_PEERING - for peer networks
This should only be set when using an Internal address.
values:
- :VPC_PEERING
min_version: beta
- !ruby/object:Api::Type::ResourceRef
name: 'network'
resource: 'Network'
imports: 'selfLink'
description: |
The URL of the network in which to reserve the IP range. The IP range
must be in RFC1918 space. The network cannot be deleted if there are
any reserved IP ranges referring to it.
This should only be set when using an Internal address.
min_version: beta
# status is not useful for state convergence
# users[] is not useful for state convergence
- !ruby/object:Api::Resource
Expand Down
2 changes: 2 additions & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ overrides: !ruby/object:Provider::ResourceOverrides
exclude: false
region: !ruby/object:Provider::Terraform::PropertyOverride
exclude: true
addressType: !ruby/object:Provider::Terraform::PropertyOverride
diff_suppress_func: 'emptyOrDefaultStringSuppress("EXTERNAL")'
custom_code: !ruby/object:Provider::Terraform::CustomCode
post_create: templates/terraform/post_create/labels.erb
GlobalForwardingRule: !ruby/object:Provider::Terraform::ResourceOverride
Expand Down
36 changes: 36 additions & 0 deletions templates/terraform/tests/resource_compute_global_address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) {
})
}

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

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeGlobalAddress_internal(),
},
resource.TestStep{
ResourceName: "google_compute_global_address.foobar",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccCheckComputeGlobalAddressDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)

Expand Down Expand Up @@ -156,3 +176,19 @@ resource "google_compute_global_address" "foobar" {
ip_version = "IPV6"
}`, acctest.RandString(10))
}

func testAccComputeGlobalAddress_internal() string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "address-test-%s"
}
resource "google_compute_global_address" "foobar" {
name = "address-test-%s"
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 24
network = "${google_compute_network.foobar.self_link}"
}`, acctest.RandString(10), acctest.RandString(10))
}

0 comments on commit e2c7b45

Please sign in to comment.