mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
2a38d03250
Yesterday, a certificate expiration triggered the `patch_bazel_windows` job to run when it shouldn't, and it overrode an artifact we depend on. This was build from the same sources, but the build is not reproducible so we ended up with a hash mismatch. As far as I know, there is no good reason for CI to ever delete or overwrite anything from our GCS buckets, so I'm removing its rights to do so. As an added safety measure, this PR also enables versioning on all non-cache buckets (GCS does not support versioning on buckets with an expiration policy). CHANGELOG_BEGIN CHANGELOG_END
64 lines
2.0 KiB
HCL
64 lines
2.0 KiB
HCL
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
resource "google_storage_bucket" "data" {
|
|
project = "${local.project}"
|
|
name = "daml-data"
|
|
labels = "${local.labels}"
|
|
|
|
# SLA is enough for a cache and is cheaper than MULTI_REGIONAL
|
|
# see https://cloud.google.com/storage/docs/storage-classes
|
|
storage_class = "REGIONAL"
|
|
|
|
# Use a normal region since the storage_class is regional
|
|
location = "${local.region}"
|
|
|
|
versioning {
|
|
enabled = true
|
|
}
|
|
}
|
|
|
|
resource "google_storage_bucket_acl" "data" {
|
|
bucket = "${google_storage_bucket.data.name}"
|
|
|
|
role_entity = [
|
|
"OWNER:project-owners-${data.google_project.current.number}",
|
|
"OWNER:project-editors-${data.google_project.current.number}",
|
|
"READER:project-viewers-${data.google_project.current.number}",
|
|
]
|
|
}
|
|
|
|
// allow rw access for CI writer (see writer.tf)
|
|
resource "google_storage_bucket_iam_member" "data_create" {
|
|
bucket = "${google_storage_bucket.data.name}"
|
|
|
|
# https://cloud.google.com/storage/docs/access-control/iam-roles
|
|
role = "roles/storage.objectCreator"
|
|
member = "serviceAccount:${google_service_account.writer.email}"
|
|
}
|
|
resource "google_storage_bucket_iam_member" "data_read" {
|
|
bucket = "${google_storage_bucket.data.name}"
|
|
|
|
# https://cloud.google.com/storage/docs/access-control/iam-roles
|
|
role = "roles/storage.objectViewer"
|
|
member = "serviceAccount:${google_service_account.writer.email}"
|
|
}
|
|
|
|
// allow read access for appr team, as requested by Moritz
|
|
variable "appr" {
|
|
description = "Application Runtime team members"
|
|
default = [
|
|
"user:andreas.herrmann@digitalasset.com",
|
|
"user:gary.verhaegen@digitalasset.com",
|
|
"user:leonid.shlyapnikov@digitalasset.com",
|
|
"user:moritz.kiefer@digitalasset.com",
|
|
"user:stephen.compall@digitalasset.com",
|
|
]
|
|
}
|
|
resource "google_storage_bucket_iam_member" "appr" {
|
|
count = "${length(var.appr)}"
|
|
bucket = "${google_storage_bucket.data.name}"
|
|
role = "roles/storage.objectViewer"
|
|
member = "${var.appr[count.index]}"
|
|
}
|