Skip to content

Commit

Permalink
fix: Allow cleanup of buckets even if there are objects in them (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
a200462790 authored Apr 5, 2021
1 parent 7ba6a18 commit cad73dd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Then perform the following commands on the root folder:

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| allow\_force\_destroy | Allows full cleanup of resources by disabling any deletion safe guards | `bool` | `false` | no |
| certmanager\_email | Email used to retrieve SSL certificates from Let's Encrypt | `any` | n/a | yes |
| domain | Domain for hosting gitlab functionality (ie mydomain.com would access gitlab at gitlab.mydomain.com) | `string` | `""` | no |
| gitlab\_address\_name | Name of the address to use for GitLab ingress | `string` | `""` | no |
Expand Down
40 changes: 24 additions & 16 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -198,43 +198,51 @@ resource "google_redis_instance" "gitlab" {

// Cloud Storage
resource "google_storage_bucket" "gitlab-backups" {
name = "${var.project_id}-gitlab-backups"
location = var.region
name = "${var.project_id}-gitlab-backups"
location = var.region
force_destroy = var.allow_force_destroy
}

resource "google_storage_bucket" "gitlab-uploads" {
name = "${var.project_id}-gitlab-uploads"
location = var.region
name = "${var.project_id}-gitlab-uploads"
location = var.region
force_destroy = var.allow_force_destroy
}

resource "google_storage_bucket" "gitlab-artifacts" {
name = "${var.project_id}-gitlab-artifacts"
location = var.region
name = "${var.project_id}-gitlab-artifacts"
location = var.region
force_destroy = var.allow_force_destroy
}

resource "google_storage_bucket" "git-lfs" {
name = "${var.project_id}-git-lfs"
location = var.region
name = "${var.project_id}-git-lfs"
location = var.region
force_destroy = var.allow_force_destroy
}

resource "google_storage_bucket" "gitlab-packages" {
name = "${var.project_id}-gitlab-packages"
location = var.region
name = "${var.project_id}-gitlab-packages"
location = var.region
force_destroy = var.allow_force_destroy
}

resource "google_storage_bucket" "gitlab-registry" {
name = "${var.project_id}-registry"
location = var.region
name = "${var.project_id}-registry"
location = var.region
force_destroy = var.allow_force_destroy
}

resource "google_storage_bucket" "gitlab-pseudo" {
name = "${var.project_id}-pseudo"
location = var.region
name = "${var.project_id}-pseudo"
location = var.region
force_destroy = var.allow_force_destroy
}

resource "google_storage_bucket" "gitlab-runner-cache" {
name = "${var.project_id}-runner-cache"
location = var.region
name = "${var.project_id}-runner-cache"
location = var.region
force_destroy = var.allow_force_destroy
}
// GKE Cluster
module "gke" {
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,15 @@ variable "gitlab_services_subnet_cidr" {
default = "10.2.0.0/16"
description = "Cidr range to use for gitlab GKE services subnet"
}

variable "helm_chart_version" {
type = string
default = "4.2.4"
description = "Helm chart version to install during deployment"
}

variable "allow_force_destroy" {
type = bool
default = false
description = "Allows full cleanup of resources by disabling any deletion safe guards"
}

0 comments on commit cad73dd

Please sign in to comment.