Skip to content

Commit 1d677be

Browse files
committed
disable iam for cloud run
1 parent f411585 commit 1d677be

4 files changed

Lines changed: 8 additions & 22 deletions

File tree

CLOUD_SHELL_TUTORIAL.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ Check Ingress (Should be `allowAll: true`):
4545
gcloud org-policies describe "run.allowedIngress" --effective --project="$GOOGLE_CLOUD_PROJECT" --quiet
4646
```
4747

48-
Check Domain Sharing (Should be `allowAll: true`):
49-
50-
```bash
51-
gcloud org-policies describe "iam.allowedPolicyMemberDomains" --effective --project="$GOOGLE_CLOUD_PROJECT" --quiet
52-
```
53-
5448
If these are restrictive, you may need to ask your Organization Admin to adjust them or use a project outside the organization. See [gcp/README.md](https://github.com/Cyclenerd/google-cloud-github-runner/blob/master/gcp/README.md) for policy details.
5549

5650
## Step 4: Deploy with Terraform
@@ -59,7 +53,7 @@ The Terraform version pre-installed in Google Cloud Shell is too old.
5953
Install a current Terraform version:
6054

6155
```bash
62-
curl "https://releases.hashicorp.com/terraform/1.14.3/terraform_1.14.3_linux_amd64.zip" -o "$HOME/terraform.zip"
56+
curl "https://releases.hashicorp.com/terraform/1.14.5/terraform_1.14.5_linux_amd64.zip" -o "$HOME/terraform.zip"
6357
unzip "$HOME/terraform.zip" terraform -d "$HOME"
6458
export PATH="$HOME:$PATH"
6559
```

gcp/README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The **Owner role** (`roles/owner`) is the easiest option for deploying this proj
2020
| `roles/iam.roleViewer` | Role Viewer | Provides read access to all custom roles in the project. |
2121
| `roles/iam.serviceAccountAdmin` | Service Account Admin | Create and manage service accounts. |
2222
| `roles/iam.serviceAccountUser` | Service Account User | Run operations as the service account. |
23+
| `roles/logging.admin` | Logging Admin | Access to all logging permissions, and dependent permissions. |
2324
| `roles/monitoring.admin` | Monitoring Admin | All monitoring permissions. |
2425
| `roles/orgpolicy.policyViewer` | Organization Policy Viewer | View organization policies |
2526
| `roles/resourcemanager.projectIamAdmin` | Project IAM Admin | Access and administer a project IAM policies. |
@@ -53,9 +54,7 @@ gcloud auth application-default set-quota-project "$GOOGLE_CLOUD_PROJECT"
5354

5455
### 2. Organization Policy
5556

56-
Make sure that the organization policy
57-
- "Allowed ingress settings (Cloud Run)" `run.allowedIngress` is configured and set to `all`, and
58-
- "Domain restricted sharing" `iam.allowedPolicyMemberDomains` is configured and set to `allowAll`.
57+
Make sure that the organization policy "Allowed ingress settings (Cloud Run)" `run.allowedIngress` is configured and set to `all`.
5958

6059
```yaml
6160
run.allowedIngress
@@ -64,11 +63,6 @@ spec:
6463
- values:
6564
allowedValues:
6665
- all
67-
68-
iam.allowedPolicyMemberDomains
69-
spec:
70-
rules:
71-
- allowAll: true
7266
```
7367
7468
> That is the default setting.
@@ -77,7 +71,6 @@ spec:
7771
```bash
7872
gcloud services enable "orgpolicy.googleapis.com" --project="$GOOGLE_CLOUD_PROJECT"
7973
gcloud org-policies describe "run.allowedIngress" --effective --project="$GOOGLE_CLOUD_PROJECT"
80-
gcloud org-policies describe "iam.allowedPolicyMemberDomains" --effective --project="$GOOGLE_CLOUD_PROJECT"
8174
```
8275

8376
If you are using the [Fabric FAST Project Factory](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric), add the following to your `your-project-id.yaml`:
@@ -89,9 +82,6 @@ org_policies:
8982
- allow:
9083
values:
9184
- all
92-
iam.allowedPolicyMemberDomains:
93-
rules:
94-
- allow_all: true
9585
```
9686
9787
See <https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints> for more information.

gcp/cloud-run.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ module "cloud_run_github_runners_manager" {
5757
}
5858
}
5959
service_config = {
60+
# Disable IAM permission check
61+
# There should be no requirement to pass the roles/run.invoker to the IAM block to enable public access.
62+
# This allows for the org policy domain restricted sharing org policy remain enabled.
63+
invoker_iam_disabled = true
6064
# Second generation Cloud Run for faster CPU.
6165
# The first generation with faster cold starts is still too slow for our webhook.
6266
gen2_execution_environment = true
@@ -69,9 +73,6 @@ module "cloud_run_github_runners_manager" {
6973
create = false
7074
email = module.service-account-cloud-run-github-runners-manager.email
7175
}
72-
iam = {
73-
"roles/run.invoker" = ["allUsers"] # Public
74-
}
7576
deletion_protection = false
7677
depends_on = [
7778
google_secret_manager_secret_version.secret-version-default,

tools/assign-iam-roles.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ROLES=(
3636
"roles/iam.roleViewer"
3737
"roles/iam.serviceAccountAdmin"
3838
"roles/iam.serviceAccountUser"
39+
"roles/logging.admin"
3940
"roles/monitoring.admin"
4041
"roles/orgpolicy.policyViewer"
4142
"roles/resourcemanager.projectIamAdmin"

0 commit comments

Comments
 (0)