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

Removing version guards for fields going GA #10613

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mmv1/products/compute/Router.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ properties:
- !ruby/object:Api::Type::String
name: identifierRange
default_from_api: true
min_version: beta
description: |
Explicitly specifies a range of valid BGP Identifiers for this Router.
It is provided as a link-local IPv4 range (from 169.254.0.0/16), of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,14 @@ func TestAccComputeRouterPeer_Ipv6Basic(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccComputeRouterPeer_Ipv4BasicCreateUpdate(t *testing.T) {
t.Parallel()

routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10))
resourceName := "google_compute_router_peer.foobar"
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeRouterPeerDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -249,7 +248,6 @@ func TestAccComputeRouterPeer_Ipv4BasicCreateUpdate(t *testing.T) {
},
})
}
<% end -%>

func TestAccComputeRouterPeer_UpdateIpv6Address(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -1547,16 +1545,13 @@ resource "google_compute_router_peer" "foobar" {
`, routerName, routerName, routerName, routerName, routerName, routerName, routerName, routerName, enableIpv6)
}

<% unless version == 'ga' -%>
func testAccComputeRouterPeerIpv4(routerName string) string {
return fmt.Sprintf(`resource "google_compute_network" "foobar" {
provider = google-beta
name = "%s-net"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "foobar" {
provider = google-beta
name = "%s-subnet"
network = google_compute_network.foobar.self_link
ip_cidr_range = "10.0.0.0/16"
Expand All @@ -1566,15 +1561,13 @@ func testAccComputeRouterPeerIpv4(routerName string) string {
}

resource "google_compute_ha_vpn_gateway" "foobar" {
provider = google-beta
name = "%s-gateway"
network = google_compute_network.foobar.self_link
region = google_compute_subnetwork.foobar.region
stack_type = "IPV4_IPV6"
}

resource "google_compute_external_vpn_gateway" "external_gateway" {
provider = google-beta
name = "%s-external-gateway"
redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT"
description = "An externally managed VPN gateway"
Expand All @@ -1585,7 +1578,6 @@ func testAccComputeRouterPeerIpv4(routerName string) string {
}

resource "google_compute_router" "foobar" {
provider = google-beta
name = "%s"
region = google_compute_subnetwork.foobar.region
network = google_compute_network.foobar.self_link
Expand All @@ -1595,7 +1587,6 @@ func testAccComputeRouterPeerIpv4(routerName string) string {
}

resource "google_compute_vpn_tunnel" "foobar" {
provider = google-beta
name = "%s-tunnel"
region = google_compute_subnetwork.foobar.region
vpn_gateway = google_compute_ha_vpn_gateway.foobar.id
Expand All @@ -1607,7 +1598,6 @@ func testAccComputeRouterPeerIpv4(routerName string) string {
}

resource "google_compute_router_interface" "foobar" {
provider = google-beta
name = "%s-interface"
router = google_compute_router.foobar.name
region = google_compute_router.foobar.region
Expand All @@ -1616,7 +1606,6 @@ func testAccComputeRouterPeerIpv4(routerName string) string {
}

resource "google_compute_router_peer" "foobar" {
provider = google-beta
name = "%s-peer"
router = google_compute_router.foobar.name
region = google_compute_router.foobar.region
Expand All @@ -1636,13 +1625,11 @@ func testAccComputeRouterPeerIpv4(routerName string) string {

func testAccComputeRouterPeerUpdateIpv4Address(routerName string) string {
return fmt.Sprintf(`resource "google_compute_network" "foobar" {
provider = google-beta
name = "%s-net"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "foobar" {
provider = google-beta
name = "%s-subnet"
network = google_compute_network.foobar.self_link
ip_cidr_range = "10.0.0.0/16"
Expand All @@ -1652,15 +1639,13 @@ func testAccComputeRouterPeerUpdateIpv4Address(routerName string) string {
}

resource "google_compute_ha_vpn_gateway" "foobar" {
provider = google-beta
name = "%s-gateway"
network = google_compute_network.foobar.self_link
region = google_compute_subnetwork.foobar.region
stack_type = "IPV4_IPV6"
}

resource "google_compute_external_vpn_gateway" "external_gateway" {
provider = google-beta
name = "%s-external-gateway"
redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT"
description = "An externally managed VPN gateway"
Expand All @@ -1671,7 +1656,6 @@ func testAccComputeRouterPeerUpdateIpv4Address(routerName string) string {
}

resource "google_compute_router" "foobar" {
provider = google-beta
name = "%s"
region = google_compute_subnetwork.foobar.region
network = google_compute_network.foobar.self_link
Expand All @@ -1681,7 +1665,6 @@ func testAccComputeRouterPeerUpdateIpv4Address(routerName string) string {
}

resource "google_compute_vpn_tunnel" "foobar" {
provider = google-beta
name = "%s-tunnel"
region = google_compute_subnetwork.foobar.region
vpn_gateway = google_compute_ha_vpn_gateway.foobar.id
Expand All @@ -1693,7 +1676,6 @@ func testAccComputeRouterPeerUpdateIpv4Address(routerName string) string {
}

resource "google_compute_router_interface" "foobar" {
provider = google-beta
name = "%s-interface"
router = google_compute_router.foobar.name
region = google_compute_router.foobar.region
Expand All @@ -1702,7 +1684,6 @@ func testAccComputeRouterPeerUpdateIpv4Address(routerName string) string {
}

resource "google_compute_router_peer" "foobar" {
provider = google-beta
name = "%s-peer"
router = google_compute_router.foobar.name
region = google_compute_router.foobar.region
Expand All @@ -1719,4 +1700,3 @@ func testAccComputeRouterPeerUpdateIpv4Address(routerName string) string {
}
`, routerName, routerName, routerName, routerName, routerName, routerName, routerName, routerName)
}
<% end -%>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
<% unless version == "ga" -%>
"github.com/hashicorp/terraform-provider-google/google/verify"
<% end -%>
"google.golang.org/api/googleapi"

<% if version == "ga" -%>
Expand Down Expand Up @@ -82,8 +80,7 @@ func ResourceComputeRouterInterface() *schema.Resource {
Computed: true,
AtLeastOneOf: []string{"ip_range", "interconnect_attachment", "subnetwork", "vpn_tunnel"},
Description: `The IP address and range of the interface. The IP range must be in the RFC3927 link-local IP space. Changing this forces a new interface to be created.`,
},
<% unless version == 'ga' -%>
},
"ip_version": {
Type: schema.TypeString,
Optional: true,
Expand All @@ -92,7 +89,6 @@ func ResourceComputeRouterInterface() *schema.Resource {
ValidateFunc: verify.ValidateEnum([]string{"IPV4", "IPV6"}),
Description: `IP version of this interface.`,
},
<% end -%>
"private_ip_address": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -191,11 +187,9 @@ func resourceComputeRouterInterfaceCreate(d *schema.ResourceData, meta interface
iface.IpRange = ipRangeVal.(string)
}

<% unless version == 'ga' -%>
if ipVersionVal, ok := d.GetOk("ip_version"); ok {
iface.IpVersion = ipVersionVal.(string)
}
<% end -%>

if privateIpVal, ok := d.GetOk("private_ip_address"); ok {
iface.PrivateIpAddress = privateIpVal.(string)
Expand Down Expand Up @@ -288,11 +282,9 @@ func resourceComputeRouterInterfaceRead(d *schema.ResourceData, meta interface{}
if err := d.Set("ip_range", iface.IpRange); err != nil {
return fmt.Errorf("Error setting ip_range: %s", err)
}
<% unless version == 'ga' -%>
if err := d.Set("ip_version", iface.IpVersion); err != nil {
return fmt.Errorf("Error setting ip_version: %s", err)
}
<% end -%>
if err := d.Set("private_ip_address", iface.PrivateIpAddress); err != nil {
return fmt.Errorf("Error setting private_ip_address: %s", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,13 @@ func TestAccComputeRouterInterface_withPrivateIpAddress(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccComputeRouterInterface_withIPVersionV4(t *testing.T) {
t.Parallel()

routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10))
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeRouterInterfaceDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand All @@ -150,7 +149,7 @@ func TestAccComputeRouterInterface_withIPVersionV6(t *testing.T) {
routerName := fmt.Sprintf("tf-test-router-%s", acctest.RandString(t, 10))
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeRouterInterfaceDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand All @@ -166,7 +165,6 @@ func TestAccComputeRouterInterface_withIPVersionV6(t *testing.T) {
},
})
}
<% end -%>

func testAccCheckComputeRouterInterfaceDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
Expand Down Expand Up @@ -561,23 +559,19 @@ resource "google_compute_router_interface" "foobar" {
`, routerName, routerName, routerName, routerName, routerName)
}

<% unless version == 'ga' -%>
func testAccComputeRouterInterfaceWithIpVersionIPV6(routerName string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
provider = google-beta
name = "%s-net"
}

resource "google_compute_subnetwork" "foobar" {
provider = google-beta
name = "%s-subnet"
network = google_compute_network.foobar.self_link
ip_cidr_range = "10.0.0.0/16"
}

resource "google_compute_router" "foobar" {
provider = google-beta
name = "%s"
network = google_compute_network.foobar.self_link
bgp {
Expand All @@ -586,7 +580,6 @@ resource "google_compute_router" "foobar" {
}

resource "google_compute_router_interface" "foobar" {
provider = google-beta
name = "%s-interface"
router = google_compute_router.foobar.name
region = google_compute_router.foobar.region
Expand All @@ -599,19 +592,16 @@ resource "google_compute_router_interface" "foobar" {
func testAccComputeRouterInterfaceWithIpVersionIPV4(routerName string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
provider = google-beta
name = "%s-net"
}

resource "google_compute_subnetwork" "foobar" {
provider = google-beta
name = "%s-subnet"
network = google_compute_network.foobar.self_link
ip_cidr_range = "10.0.0.0/16"
}

resource "google_compute_router" "foobar" {
provider = google-beta
name = "%s"
network = google_compute_network.foobar.self_link
bgp {
Expand All @@ -620,13 +610,11 @@ resource "google_compute_router" "foobar" {
}

resource "google_compute_router_interface" "foobar" {
provider = google-beta
name = "%s-interface"
router = google_compute_router.foobar.name
region = google_compute_router.foobar.region
ip_range = "169.254.3.1/30"
ip_version = "IPV4"
}
`, routerName, routerName, routerName, routerName)
}
<% end -%>
}
Loading
Loading