mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 01:26:43 +00:00
105 lines
2.7 KiB
Go
105 lines
2.7 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 TestAccRedisInstance_redisInstanceBasicExample(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: testAccRedisInstance_redisInstanceBasicExample(acctest.RandString(10)),
|
|
},
|
|
{
|
|
ResourceName: "google_redis_instance.cache",
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
ImportStateVerifyIgnore: []string{"region"},
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func testAccRedisInstance_redisInstanceBasicExample(val string) string {
|
|
return fmt.Sprintf(`
|
|
resource "google_redis_instance" "cache" {
|
|
name = "memory-cache-%s"
|
|
memory_size_gb = 1
|
|
}
|
|
`, val,
|
|
)
|
|
}
|
|
|
|
func TestAccRedisInstance_redisInstanceFullExample(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: testAccRedisInstance_redisInstanceFullExample(acctest.RandString(10)),
|
|
},
|
|
{
|
|
ResourceName: "google_redis_instance.cache",
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
ImportStateVerifyIgnore: []string{"region"},
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
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,
|
|
)
|
|
}
|