Skip to content

Commit 434baf3

Browse files
authored
Merge pull request #7299 from ameukam/releng-releases-prod-iam
gcp/dl: Define IAM policy for the production bucket
2 parents d100298 + 6137c00 commit 434baf3

File tree

4 files changed

+82
-45
lines changed

4 files changed

+82
-45
lines changed

infra/gcp/terraform/k8s-infra-releases-prod/.terraform.lock.hcl

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
data "google_iam_policy" "releng_access" {
18+
binding {
19+
role = "roles/storage.objectViewer"
20+
members = [
21+
22+
"serviceAccount:${google_service_account.fastly_reader.email}"
23+
]
24+
}
25+
26+
// TODO: remove this after https://github.com/kubernetes/release/issues/3425
27+
binding {
28+
role = "roles/storage.objectAdmin"
29+
members = ["serviceAccount:[email protected]"]
30+
}
31+
32+
binding {
33+
role = "roles/storage.legacyBucketOwner"
34+
members = [
35+
"projectOwner:${google_project.project.project_id}",
36+
"projectEditor:${google_project.project.project_id}"
37+
]
38+
}
39+
40+
binding {
41+
role = "roles/storage.legacyBucketReader"
42+
members = [
43+
"projectViewer:${google_project.project.project_id}",
44+
45+
]
46+
}
47+
}
48+
49+
resource "google_storage_bucket_iam_policy" "releng_access_policy" {
50+
bucket = module.k8s_releases_prod.bucket_name
51+
policy_data = data.google_iam_policy.releng_access.policy_data
52+
}

infra/gcp/terraform/k8s-infra-releases-prod/main.tf

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ resource "google_storage_hmac_key" "fastly_reader_key" {
4949
service_account_email = google_service_account.fastly_reader.email
5050
}
5151

52-
// TODO: remove this after https://github.com/kubernetes/release/issues/3425
53-
resource "google_storage_bucket_iam_member" "release_object_admin" {
54-
bucket = module.k8s_releases_prod.bucket_name
55-
role = "roles/storage.objectAdmin"
56-
member = "serviceAccount:[email protected]"
57-
depends_on = [module.k8s_releases_prod]
58-
}
59-
60-
resource "google_storage_bucket_iam_member" "fastly_reader" {
61-
bucket = module.k8s_releases_prod.bucket_name
62-
role = "roles/storage.objectViewer"
63-
member = "serviceAccount:${google_service_account.fastly_reader.email}"
64-
depends_on = [module.k8s_releases_prod]
65-
}
66-
6752
resource "google_storage_bucket_iam_member" "gcs-backup-bucket" {
6853
bucket = module.k8s_releases_prod.bucket_name
6954
role = "roles/storage.admin"

infra/gcp/terraform/k8s-infra-releases-prod/providers.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ terraform {
2929
required_providers {
3030
google = {
3131
source = "hashicorp/google"
32-
version = "~> 5.39.0"
32+
version = "~> 5.44.0"
3333
}
3434
google-beta = {
3535
source = "hashicorp/google-beta"
36-
version = "~> 5.39.0"
36+
version = "~> 5.44.0"
3737
}
3838
}
3939
}

0 commit comments

Comments
 (0)