mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 01:26:43 +00:00
97 lines
2.6 KiB
Go
97 lines
2.6 KiB
Go
// ----------------------------------------------------------------------------
|
|
//
|
|
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
//
|
|
// ----------------------------------------------------------------------------
|
|
//
|
|
// This file is automatically generated by Magic Modules and manual
|
|
// changes will be clobbered when the file is regenerated.
|
|
//
|
|
// Please read more about how to change this file in
|
|
// .github/CONTRIBUTING.md.
|
|
//
|
|
// ----------------------------------------------------------------------------
|
|
|
|
package google
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/helper/acctest"
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
)
|
|
|
|
func TestAccComputeAddress_addressBasicExample(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckComputeAddressDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: testAccComputeAddress_addressBasicExample(acctest.RandString(10)),
|
|
},
|
|
{
|
|
ResourceName: "google_compute_address.ip_address",
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func testAccComputeAddress_addressBasicExample(val string) string {
|
|
return fmt.Sprintf(`
|
|
resource "google_compute_address" "ip_address" {
|
|
name = "my-address-%s"
|
|
}
|
|
`, val,
|
|
)
|
|
}
|
|
|
|
func TestAccComputeAddress_addressWithSubnetworkExample(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckComputeAddressDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: testAccComputeAddress_addressWithSubnetworkExample(acctest.RandString(10)),
|
|
},
|
|
{
|
|
ResourceName: "google_compute_address.internal_with_subnet_and_address",
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func testAccComputeAddress_addressWithSubnetworkExample(val string) string {
|
|
return fmt.Sprintf(`
|
|
resource "google_compute_network" "default" {
|
|
name = "my-network-%s"
|
|
}
|
|
|
|
resource "google_compute_subnetwork" "default" {
|
|
name = "my-subnet-%s"
|
|
ip_cidr_range = "10.0.0.0/16"
|
|
region = "us-central1"
|
|
network = "${google_compute_network.default.self_link}"
|
|
}
|
|
|
|
resource "google_compute_address" "internal_with_subnet_and_address" {
|
|
name = "my-internal-address-%s"
|
|
subnetwork = "${google_compute_subnetwork.default.self_link}"
|
|
address_type = "INTERNAL"
|
|
address = "10.0.42.42"
|
|
region = "us-central1"
|
|
}
|
|
`, val, val, val,
|
|
)
|
|
}
|