@@ -587,6 +587,30 @@ func TestAccComputeInstance_internalIPv6(t *testing.T) {
587
587
})
588
588
}
589
589
590
+ func TestAccComputeInstance_internalIPv6PrefixLength(t *testing.T) {
591
+ t.Parallel()
592
+
593
+ var instance compute.Instance
594
+ var instanceName = fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10))
595
+
596
+ acctest.VcrTest(t, resource.TestCase{
597
+ PreCheck: func() { acctest.AccTestPreCheck(t) },
598
+ ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
599
+ CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t),
600
+ Steps: []resource.TestStep{
601
+ {
602
+ Config: testAccComputeInstance_internalIpv6PrefixLength("96", instanceName),
603
+ Check: resource.ComposeTestCheckFunc(
604
+ testAccCheckComputeInstanceExists(
605
+ t, "google_compute_instance.foobar", &instance),
606
+ testAccCheckComputeInstanceIpv6AccessConfigHasInternalIPv6(&instance),
607
+ ),
608
+ },
609
+ computeInstanceImportStep("us-west2-a", instanceName, []string{"allow_stopping_for_update"}),
610
+ },
611
+ })
612
+ }
613
+
590
614
func TestAccComputeInstance_PTRRecord(t *testing.T) {
591
615
t.Parallel()
592
616
@@ -6224,6 +6248,46 @@ func testAccComputeInstance_internalIpv6(ip, instance string) string {
6224
6248
`, instance, instance, ip, instance)
6225
6249
}
6226
6250
6251
+ func testAccComputeInstance_internalIpv6PrefixLength(length, instance string) string {
6252
+ return fmt.Sprintf(`
6253
+ resource "google_compute_network" "vpc" {
6254
+ name = "%s-network"
6255
+ auto_create_subnetworks = "false"
6256
+ enable_ula_internal_ipv6 = true
6257
+ }
6258
+
6259
+ resource "google_compute_subnetwork" "subnetwork" {
6260
+ name = "%s-subnetwork"
6261
+ ip_cidr_range = "10.0.0.0/22"
6262
+ region = "us-west2"
6263
+ stack_type = "IPV4_IPV6"
6264
+ ipv6_access_type = "INTERNAL"
6265
+ network = google_compute_network.vpc.id
6266
+ }
6267
+
6268
+ resource "google_compute_instance" "foobar" {
6269
+ name = "%s"
6270
+ machine_type = "e2-micro"
6271
+ allow_stopping_for_update = true
6272
+ zone = "us-west2-a"
6273
+ boot_disk {
6274
+ auto_delete = false
6275
+ initialize_params {
6276
+ image = "debian-cloud/debian-11"
6277
+ }
6278
+ }
6279
+ network_interface {
6280
+ network = google_compute_network.vpc.self_link
6281
+ subnetwork = google_compute_subnetwork.subnetwork.self_link
6282
+ stack_type = "IPV4_IPV6"
6283
+ access_config {
6284
+ network_tier = "STANDARD"
6285
+ }
6286
+ internal_ipv6_prefix_length = %s
6287
+ }
6288
+ }
6289
+ `, instance, instance, instance, length)
6290
+ }
6227
6291
func testAccComputeInstance_ipv6ExternalReservation(instance string) string {
6228
6292
return fmt.Sprintf(`
6229
6293
resource "google_compute_address" "ipv6-address" {
0 commit comments