terraform-provider-google/google/resource_redis_instance_generated_test.go

105 lines
2.7 KiB
Go
Raw Normal View History

// ----------------------------------------------------------------------------
//
// *** 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"
)
2018-10-24 19:06:09 +00:00
func TestAccRedisInstance_RedisInstanceBasicExample(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRedisInstanceDestroy,
Steps: []resource.TestStep{
{
2018-10-24 19:06:09 +00:00
Config: testAccRedisInstance_RedisInstanceBasicExample(acctest.RandString(10)),
},
{
ResourceName: "google_redis_instance.cache",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"region"},
},
},
})
}
2018-10-24 19:06:09 +00:00
func testAccRedisInstance_RedisInstanceBasicExample(val string) string {
return fmt.Sprintf(`
resource "google_redis_instance" "cache" {
name = "memory-cache-%s"
memory_size_gb = 1
}
`, val,
)
}
2018-10-24 19:06:09 +00:00
func TestAccRedisInstance_RedisInstanceFullExample(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRedisInstanceDestroy,
Steps: []resource.TestStep{
{
2018-10-24 19:06:09 +00:00
Config: testAccRedisInstance_RedisInstanceFullExample(acctest.RandString(10)),
},
{
ResourceName: "google_redis_instance.cache",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"region"},
},
},
})
}
2018-10-24 19:06:09 +00:00
func testAccRedisInstance_RedisInstanceFullExample(val string) string {
return fmt.Sprintf(`
resource "google_redis_instance" "cache" {
name = "ha-memory-cache-%s"
tier = "STANDARD_HA"
memory_size_gb = 1
location_id = "us-central1-a"
alternative_location_id = "us-central1-f"
authorized_network = "${google_compute_network.auto-network.self_link}"
redis_version = "REDIS_3_2"
display_name = "Terraform Test Instance"
reserved_ip_range = "192.168.0.0/29"
labels {
my_key = "my_val"
other_key = "other_val"
}
}
resource "google_compute_network" "auto-network" {
name = "authorized-network-%s"
}
`, val, val,
)
}