mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
59b08fb422
Signed-off-by: Modular Magician <magic-modules@google.com>
60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
package google
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"fmt"
|
|
"github.com/hashicorp/terraform/helper/acctest"
|
|
"github.com/hashicorp/terraform/helper/resource"
|
|
)
|
|
|
|
func TestAccTpuNode_tpuNodeBUpdateTensorFlowVersion(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
nodeId := acctest.RandomWithPrefix("tf-test")
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
Providers: testAccProviders,
|
|
CheckDestroy: testAccCheckTpuNodeDestroy,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: testAccTpuNode_tpuNodeTensorFlow(nodeId, 0),
|
|
},
|
|
{
|
|
ResourceName: "google_tpu_node.tpu",
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
ImportStateVerifyIgnore: []string{"zone"},
|
|
},
|
|
{
|
|
Config: testAccTpuNode_tpuNodeTensorFlow(nodeId, 1),
|
|
},
|
|
{
|
|
ResourceName: "google_tpu_node.tpu",
|
|
ImportState: true,
|
|
ImportStateVerify: true,
|
|
ImportStateVerifyIgnore: []string{"zone"},
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
// WARNING: cidr_block must not overlap with other existing TPU blocks
|
|
// Make sure if you change this value that it does not overlap with the
|
|
// autogenerated examples.
|
|
func testAccTpuNode_tpuNodeTensorFlow(nodeId string, versionIdx int) string {
|
|
return fmt.Sprintf(`
|
|
data "google_tpu_tensorflow_versions" "available" { }
|
|
|
|
resource "google_tpu_node" "tpu" {
|
|
name = "%s"
|
|
zone = "us-central1-b"
|
|
|
|
accelerator_type = "v3-8"
|
|
tensorflow_version = "${data.google_tpu_tensorflow_versions.available.versions[%d]}"
|
|
cidr_block = "10.1.0.0/29"
|
|
}
|
|
`, nodeId, versionIdx)
|
|
}
|