@@ -1076,3 +1076,124 @@ resource "google_cloud_run_v2_service" "default" {
1076
1076
`, context)
1077
1077
}
1078
1078
<% end -%>
1079
+
1080
+ <% unless version == 'ga' -%>
1081
+ func TestAccCloudRunV2Service_cloudrunv2ServiceMeshUpdate(t *testing.T) {
1082
+ t.Parallel()
1083
+
1084
+ context := map[string]interface{}{
1085
+ "random_suffix": acctest.RandString(t, 10),
1086
+ }
1087
+
1088
+ acctest.VcrTest(t, resource.TestCase{
1089
+ PreCheck: func() { acctest.AccTestPreCheck(t) },
1090
+ ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
1091
+ ExternalProviders: map[string]resource.ExternalProvider{
1092
+ "time": {},
1093
+ },
1094
+ CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t),
1095
+ Steps: []resource.TestStep{
1096
+ {
1097
+ Config: testAccCloudRunV2Service_cloudrunv2ServiceMesh(context),
1098
+ },
1099
+ {
1100
+ ResourceName: "google_cloud_run_v2_service.default",
1101
+ ImportState: true,
1102
+ ImportStateVerify: true,
1103
+ ImportStateVerifyIgnore: []string{"name", "location", "annotations", "labels", "terraform_labels", "launch_stage", "deletion_protection"},
1104
+ },
1105
+ {
1106
+ Config: testAccCloudRunV2Service_cloudrunv2ServiceMeshUpdate(context),
1107
+ },
1108
+ {
1109
+ ResourceName: "google_cloud_run_v2_service.default",
1110
+ ImportState: true,
1111
+ ImportStateVerify: true,
1112
+ ImportStateVerifyIgnore: []string{"name", "location", "annotations", "labels", "terraform_labels", "launch_stage", "deletion_protection"},
1113
+ },
1114
+ },
1115
+ })
1116
+ }
1117
+
1118
+ func testAccCloudRunV2Service_cloudrunv2ServiceMesh(context map[string]interface{}) string {
1119
+ return acctest.Nprintf(`
1120
+ resource "google_cloud_run_v2_service" "default" {
1121
+ provider = google-beta
1122
+ name = "tf-test-cloudrun-service%{random_suffix}"
1123
+ location = "us-central1"
1124
+ deletion_protection = false
1125
+ depends_on = [time_sleep.wait_for_mesh]
1126
+ launch_stage = "BETA"
1127
+ template {
1128
+ containers {
1129
+ name = "container-1"
1130
+ image = "us-docker.pkg.dev/cloudrun/container/hello"
1131
+ }
1132
+ service_mesh {
1133
+ mesh = google_network_services_mesh.mesh.id
1134
+ }
1135
+ }
1136
+ }
1137
+
1138
+ resource "time_sleep" "wait_for_mesh" {
1139
+ depends_on = [
1140
+ google_network_services_mesh.mesh,
1141
+ google_network_services_mesh.new_mesh,
1142
+ ]
1143
+
1144
+ create_duration = "1m"
1145
+ }
1146
+
1147
+ resource "google_network_services_mesh" "mesh" {
1148
+ provider = google-beta
1149
+ name = "tf-test-mesh%{random_suffix}"
1150
+ }
1151
+
1152
+ resource "google_network_services_mesh" "new_mesh" {
1153
+ provider = google-beta
1154
+ name = "tf-test-new-mesh%{random_suffix}"
1155
+ }
1156
+ `, context)
1157
+ }
1158
+
1159
+ func testAccCloudRunV2Service_cloudrunv2ServiceMeshUpdate(context map[string]interface{}) string {
1160
+ return acctest.Nprintf(`
1161
+ resource "google_cloud_run_v2_service" "default" {
1162
+ provider = google-beta
1163
+ name = "tf-test-cloudrun-service%{random_suffix}"
1164
+ location = "us-central1"
1165
+ deletion_protection = false
1166
+ depends_on = [time_sleep.wait_for_mesh]
1167
+ launch_stage = "BETA"
1168
+ template {
1169
+ containers {
1170
+ name = "container-1"
1171
+ image = "us-docker.pkg.dev/cloudrun/container/hello"
1172
+ }
1173
+ service_mesh {
1174
+ mesh = google_network_services_mesh.new_mesh.id
1175
+ }
1176
+ }
1177
+ }
1178
+
1179
+ resource "time_sleep" "wait_for_mesh" {
1180
+ depends_on = [
1181
+ google_network_services_mesh.mesh,
1182
+ google_network_services_mesh.new_mesh,
1183
+ ]
1184
+
1185
+ create_duration = "1m"
1186
+ }
1187
+
1188
+ resource "google_network_services_mesh" "mesh" {
1189
+ provider = google-beta
1190
+ name = "tf-test-mesh%{random_suffix}"
1191
+ }
1192
+
1193
+ resource "google_network_services_mesh" "new_mesh" {
1194
+ provider = google-beta
1195
+ name = "tf-test-new-mesh%{random_suffix}"
1196
+ }
1197
+ `, context)
1198
+ }
1199
+ <% end -%>
0 commit comments