Verified Commit fe0d1203 authored by Alex Hanselka's avatar Alex Hanselka
Browse files

create bucket for maven packages

parent 8b49c605
...@@ -5,6 +5,7 @@ variable "versioning" {} ...@@ -5,6 +5,7 @@ variable "versioning" {}
variable "artifact_age" {} variable "artifact_age" {}
variable "upload_age" {} variable "upload_age" {}
variable "lfs_object_age" {} variable "lfs_object_age" {}
variable "package_repo_age" {}
variable "storage_class" {} variable "storage_class" {}
variable "gcs_service_account_email" {} variable "gcs_service_account_email" {}
...@@ -181,6 +182,45 @@ resource "google_storage_bucket_iam_binding" "artifacts-binding" { ...@@ -181,6 +182,45 @@ resource "google_storage_bucket_iam_binding" "artifacts-binding" {
] ]
} }
resource "google_storage_bucket" "package-repo" {
name = "gitlab-${var.environment}-package-repo"
versioning = {
enabled = "${var.versioning}"
}
storage_class = "${var.storage_class}"
labels = {
tfmanaged = "yes"
}
lifecycle_rule = {
action = {
type = "Delete"
}
condition = {
age = "${var.package_repo_age}"
is_live = "false"
}
}
logging = {
log_bucket = "gitlab-${var.environment}-storage-logs"
}
}
resource "google_storage_bucket_iam_binding" "package-repo-binding" {
bucket = "gitlab-${var.environment}-package-repo"
role = "roles/storage.objectAdmin"
depends_on = ["google_storage_bucket.package-repo"]
members = [
"serviceAccount:${var.gcs_service_account_email}",
]
}
resource "google_storage_bucket" "registry" { resource "google_storage_bucket" "registry" {
name = "gitlab-${var.environment}-registry" name = "gitlab-${var.environment}-registry"
......
...@@ -20,6 +20,11 @@ variable "lfs_object_age" { ...@@ -20,6 +20,11 @@ variable "lfs_object_age" {
default = "30" default = "30"
} }
variable "package_repo_age" {
type = "string"
default = "30"
}
variable "storage_class" { variable "storage_class" {
type = "string" type = "string"
default = "MULTI_REGIONAL" default = "MULTI_REGIONAL"
......
...@@ -1304,6 +1304,7 @@ module "gitlab_object_storage" { ...@@ -1304,6 +1304,7 @@ module "gitlab_object_storage" {
versioning = "${var.versioning}" versioning = "${var.versioning}"
artifact_age = "${var.artifact_age}" artifact_age = "${var.artifact_age}"
lfs_object_age = "${var.lfs_object_age}" lfs_object_age = "${var.lfs_object_age}"
package_repo_age = "${var.package_repo_age}"
upload_age = "${var.upload_age}" upload_age = "${var.upload_age}"
storage_log_age = "${var.storage_log_age}" storage_log_age = "${var.storage_log_age}"
storage_class = "${var.storage_class}" storage_class = "${var.storage_class}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment