Skip to content

Commit 7b12950

Browse files
committed
ENH: Give GHA service account permission to access static bucket
1 parent f92cc66 commit 7b12950

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,15 @@ terraform destroy
144144

145145
# Input reference
146146

147-
| Name | Type | Required | Default |
148-
|--------------------------------|------------|----------|------------|
149-
| `server_service_account_email` | `string` | Yes | N/A |
150-
| `google_cloud_project_id` | `string` | Yes | N/A |
151-
| `resource_affix` | `string` | Yes | N/A |
152-
| `environment` | `string` | No | `"main"` |
153-
| `create_public_bucket` | `boolean` | No | `false` |
154-
| `deletion_protection` | `bool` | No | `true` |
147+
| Name | Type | Required | Default |
148+
|----------------------------------------|------------|----------|------------|
149+
| `server_service_account_email` | `string` | Yes | N/A |
150+
| `github_actions_service_account_email` | `string` | Yes | N/A |
151+
| `google_cloud_project_id` | `string` | Yes | N/A |
152+
| `resource_affix` | `string` | Yes | N/A |
153+
| `environment` | `string` | No | `"main"` |
154+
| `create_public_bucket` | `boolean` | No | `false` |
155+
| `deletion_protection` | `bool` | No | `true` |
155156

156157
See [`variables.tf`](/variables.tf) for descriptions.
157158

VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.1.1

storage.tf

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ resource "google_storage_bucket_iam_member" "static_assets_object_viewer" {
2525
}
2626

2727

28-
# Allow the server to administer what's on the staging bucket
28+
# Allow the server to administer what's on the static bucket.
2929
resource "google_storage_bucket_iam_member" "static_assets_object_admin" {
30+
for_each = toset(
31+
[
32+
"serviceAccount:${var.server_service_account_email}"],
33+
"serviceAccount:${var.github_actions_service_account_email}"
34+
)
3035
bucket = google_storage_bucket.static_assets.name
3136
role = "roles/storage.objectAdmin"
32-
member = "serviceAccount:${var.server_service_account_email}"
37+
member = each.value
3338
}
3439

3540

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ variable "server_service_account_email" {
44
}
55

66

7+
variable "github_actions_service_account_email" {
8+
type = string
9+
description = "The email address of the GitHub Actions service account."
10+
}
11+
12+
713
variable "google_cloud_project_id" {
814
type = string
915
description = "The ID of the GCP project to deploy resources in."

0 commit comments

Comments
 (0)