@@ -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
@@ -6220,6 +6244,46 @@ func testAccComputeInstance_internalIpv6(ip, instance string) string {
6220
6244
`, instance, instance, ip, instance)
6221
6245
}
6222
6246
6247
+ func testAccComputeInstance_internalIpv6PrefixLength(length, instance string) string {
6248
+ return fmt.Sprintf(`
6249
+ resource "google_compute_network" "vpc" {
6250
+ name = "%s-network"
6251
+ auto_create_subnetworks = "false"
6252
+ enable_ula_internal_ipv6 = true
6253
+ }
6254
+
6255
+ resource "google_compute_subnetwork" "subnetwork" {
6256
+ name = "%s-subnetwork"
6257
+ ip_cidr_range = "10.0.0.0/22"
6258
+ region = "us-west2"
6259
+ stack_type = "IPV4_IPV6"
6260
+ ipv6_access_type = "INTERNAL"
6261
+ network = google_compute_network.vpc.id
6262
+ }
6263
+
6264
+ resource "google_compute_instance" "foobar" {
6265
+ name = "%s"
6266
+ machine_type = "e2-micro"
6267
+ allow_stopping_for_update = true
6268
+ zone = "us-west2-a"
6269
+ boot_disk {
6270
+ auto_delete = false
6271
+ initialize_params {
6272
+ image = "debian-cloud/debian-11"
6273
+ }
6274
+ }
6275
+ network_interface {
6276
+ network = google_compute_network.vpc.self_link
6277
+ subnetwork = google_compute_subnetwork.subnetwork.self_link
6278
+ stack_type = "IPV4_IPV6"
6279
+ access_config {
6280
+ network_tier = "STANDARD"
6281
+ }
6282
+ internal_ipv6_prefix_length = %s
6283
+ }
6284
+ }
6285
+ `, instance, instance, instance, length)
6286
+ }
6223
6287
func testAccComputeInstance_ipv6ExternalReservation(instance string) string {
6224
6288
return fmt.Sprintf(`
6225
6289
resource "google_compute_address" "ipv6-address" {
0 commit comments