mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-06 02:02:43 +00:00
Allow specifying resource name for project metadata item config in tests (#305)
This commit is contained in:
parent
8d215aaac3
commit
73ef33191d
|
@ -16,7 +16,7 @@ func TestAccComputeProjectMetadataItem_importBasic(t *testing.T) {
|
|||
CheckDestroy: testAccCheckProjectMetadataItemDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccProjectMetadataItem_basic(key, "myValue"),
|
||||
Config: testAccProjectMetadataItem_basicWithResourceName("foobar", key, "myValue"),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_project_metadata_item.foobar",
|
||||
|
|
|
@ -77,13 +77,13 @@ func TestAccComputeProjectMetadataItem_basicUpdate(t *testing.T) {
|
|||
CheckDestroy: testAccCheckProjectMetadataItemDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccProjectMetadataItem_basic(key, "myValue"),
|
||||
Config: testAccProjectMetadataItem_basicWithResourceName("foobar", key, "myValue"),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckProjectMetadataItem_hasMetadata(key, "myValue"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccProjectMetadataItem_basic(key, "myUpdatedValue"),
|
||||
Config: testAccProjectMetadataItem_basicWithResourceName("foobar", key, "myUpdatedValue"),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckProjectMetadataItem_hasMetadata(key, "myUpdatedValue"),
|
||||
),
|
||||
|
@ -139,10 +139,14 @@ func testAccCheckProjectMetadataItemDestroy(s *terraform.State) error {
|
|||
}
|
||||
|
||||
func testAccProjectMetadataItem_basic(key, val string) string {
|
||||
return testAccProjectMetadataItem_basicWithResourceName(acctest.RandString(10), key, val)
|
||||
}
|
||||
|
||||
func testAccProjectMetadataItem_basicWithResourceName(resourceName, key, val string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_project_metadata_item" "foobar-%s" {
|
||||
resource "google_compute_project_metadata_item" "%s" {
|
||||
key = "%s"
|
||||
value = "%s"
|
||||
}
|
||||
`, acctest.RandString(10), key, val)
|
||||
`, resourceName, key, val)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user