@@ -1134,6 +1134,62 @@ resource "google_compute_global_forwarding_rule" "https_default" {
11341134` , context )
11351135}
11361136
1137+ func TestAccCloudRunService_cloudrunServiceAccessControlExample (t * testing.T ) {
1138+ t .Parallel ()
1139+
1140+ context := map [string ]interface {}{
1141+ "random_suffix" : randString (t , 10 ),
1142+ }
1143+
1144+ vcrTest (t , resource.TestCase {
1145+ PreCheck : func () { testAccPreCheck (t ) },
1146+ Providers : testAccProviders ,
1147+ CheckDestroy : testAccCheckCloudRunServiceDestroyProducer (t ),
1148+ Steps : []resource.TestStep {
1149+ {
1150+ Config : testAccCloudRunService_cloudrunServiceAccessControlExample (context ),
1151+ },
1152+ {
1153+ ResourceName : "google_cloud_run_service.default" ,
1154+ ImportState : true ,
1155+ ImportStateVerify : true ,
1156+ ImportStateVerifyIgnore : []string {"name" , "location" },
1157+ },
1158+ },
1159+ })
1160+ }
1161+
1162+ func testAccCloudRunService_cloudrunServiceAccessControlExample (context map [string ]interface {}) string {
1163+ return Nprintf (`
1164+ resource "google_cloud_run_service" "default" {
1165+ name = "tf-test-cloud-run-srv%{random_suffix}"
1166+ location = "us-central1"
1167+
1168+ template {
1169+ spec {
1170+ containers {
1171+ image = "gcr.io/cloudrun/hello"
1172+ }
1173+ }
1174+ }
1175+
1176+ traffic {
1177+ percent = 100
1178+ latest_revision = true
1179+ }
1180+ }
1181+
1182+ resource "google_cloud_run_service_iam_binding" "default" {
1183+ location = google_cloud_run_service.default.location
1184+ service = google_cloud_run_service.default.name
1185+ role = "roles/run.invoker"
1186+ members = [
1187+ "allUsers"
1188+ ]
1189+ }
1190+ ` , context )
1191+ }
1192+
11371193func TestAccCloudRunService_cloudRunSystemPackagesExample (t * testing.T ) {
11381194 t .Parallel ()
11391195
0 commit comments