terraform-provider-google/google/resource_redis_instance_test.go
The Magician b58053fe5d Bring forwards/backwards compatible 0.12 syntax to HEAD (#2984)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2019-02-01 14:45:29 -08:00

79 lines
1.6 KiB
Go

package google
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccRedisInstance_update(t *testing.T) {
t.Parallel()
name := acctest.RandomWithPrefix("tf-test")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRedisInstanceDestroy,
Steps: []resource.TestStep{
{
Config: testAccRedisInstance_update(name),
},
{
ResourceName: "google_redis_instance.test",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccRedisInstance_update2(name),
},
{
ResourceName: "google_redis_instance.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func testAccRedisInstance_update(name string) string {
return fmt.Sprintf(`
resource "google_redis_instance" "test" {
name = "%s"
display_name = "pre-update"
memory_size_gb = 1
region = "us-central1"
labels = {
my_key = "my_val"
other_key = "other_val"
}
redis_configs = {
maxmemory-policy = "allkeys-lru"
notify-keyspace-events = "KEA"
}
}`, name)
}
func testAccRedisInstance_update2(name string) string {
return fmt.Sprintf(`
resource "google_redis_instance" "test" {
name = "%s"
display_name = "post-update"
memory_size_gb = 1
labels = {
my_key = "my_val"
other_key = "new_val"
}
redis_configs = {
maxmemory-policy = "noeviction"
notify-keyspace-events = ""
}
}`, name)
}