Skip to content

Commit 60a6aa9

Browse files
Added files for spot VM examples for GA release (#5981) (#4257)
Signed-off-by: Modular Magician <[email protected]>
1 parent 1f48cd0 commit 60a6aa9

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.changelog/5981.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google-beta/resource_cgc_snippet_generated_test.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,59 @@ resource "google_storage_bucket" "default" {
116116
`, context)
117117
}
118118

119+
func TestAccCGCSnippet_spotInstanceBasicExample(t *testing.T) {
120+
t.Parallel()
121+
122+
context := map[string]interface{}{
123+
"random_suffix": randString(t, 10),
124+
}
125+
126+
vcrTest(t, resource.TestCase{
127+
PreCheck: func() { testAccPreCheck(t) },
128+
Providers: testAccProviders,
129+
Steps: []resource.TestStep{
130+
{
131+
Config: testAccCGCSnippet_spotInstanceBasicExample(context),
132+
},
133+
{
134+
ResourceName: "google_compute_instance.spot_vm_instance",
135+
ImportState: true,
136+
ImportStateVerify: true,
137+
},
138+
},
139+
})
140+
}
141+
142+
func testAccCGCSnippet_spotInstanceBasicExample(context map[string]interface{}) string {
143+
return Nprintf(`
144+
145+
resource "google_compute_instance" "spot_vm_instance" {
146+
name = "tf-test-spot-instance-name%{random_suffix}"
147+
machine_type = "f1-micro"
148+
149+
boot_disk {
150+
initialize_params {
151+
image = "debian-cloud/debian-9"
152+
}
153+
}
154+
155+
scheduling {
156+
preemptible = true
157+
automatic_restart = false
158+
provisioning_model = "SPOT"
159+
}
160+
161+
network_interface {
162+
# A default network is created for all GCP projects
163+
network = "default"
164+
access_config {
165+
}
166+
}
167+
}
168+
169+
`, context)
170+
}
171+
119172
func TestAccCGCSnippet_sqlDatabaseInstanceSqlserverExample(t *testing.T) {
120173
t.Parallel()
121174

0 commit comments

Comments
 (0)