Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable GCS bucket versioning #431

Merged
merged 3 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: Enable GCS bucket versioning
  • Loading branch information
askoriy committed Jul 20, 2020
commit 0af45a5eb1e9b17f61a62aac75ae78438ba2d4a0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ determining that location is as follows:
| bucket\_location | The location for a GCS bucket to create (optional) | string | `"US"` | no |
| bucket\_name | A name for a GCS bucket to create (in the bucket_project project), useful for Terraform state (optional) | string | `""` | no |
| bucket\_project | A project to create a GCS bucket (bucket_name) in, useful for Terraform state (optional) | string | `""` | no |
| bucket\_versioning | Enable versioning for a GCS bucket to create (optional) | bool | `"false"` | no |
| budget\_alert\_pubsub\_topic | The name of the Cloud Pub/Sub topic where budget related messages will be published, in the form of `projects/{project_id}/topics/{topic_id}` | string | `"null"` | no |
| budget\_alert\_spent\_percents | A list of percentages of the budget to alert on when threshold is exceeded | list(number) | `<list>` | no |
| budget\_amount | The amount to use for a budget alert | number | `"null"` | no |
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module "project-factory" {
bucket_project = var.bucket_project
bucket_name = var.bucket_name
bucket_location = var.bucket_location
bucket_versioning = var.bucket_versioning
auto_create_network = var.auto_create_network
disable_services_on_destroy = var.disable_services_on_destroy
default_service_account = var.default_service_account
Expand Down
4 changes: 4 additions & 0 deletions modules/core_project_factory/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ resource "google_storage_bucket" "project_bucket" {
name = local.project_bucket_name
project = var.bucket_project == local.base_project_id ? google_project.main.project_id : var.bucket_project
location = var.bucket_location

versioning {
enabled = var.bucket_versioning
}
}

/***********************************************
Expand Down
6 changes: 6 additions & 0 deletions modules/core_project_factory/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ variable "bucket_location" {
default = "US"
}

variable "bucket_versioning" {
description = "Enable versioning for a GCS bucket to create (optional)"
type = bool
default = false
}

variable "auto_create_network" {
description = "Create the default network"
type = bool
Expand Down
1 change: 1 addition & 0 deletions modules/gsuite_enabled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The roles granted are specifically:
| bucket\_location | The location for a GCS bucket to create (optional) | string | `""` | no |
| bucket\_name | A name for a GCS bucket to create (in the bucket_project project), useful for Terraform state (optional) | string | `""` | no |
| bucket\_project | A project to create a GCS bucket (bucket_name) in, useful for Terraform state (optional) | string | `""` | no |
| bucket\_versioning | Enable versioning for a GCS bucket to create (optional) | bool | `"false"` | no |
| budget\_alert\_pubsub\_topic | The name of the Cloud Pub/Sub topic where budget related messages will be published, in the form of `projects/{project_id}/topics/{topic_id}` | string | `"null"` | no |
| budget\_alert\_spent\_percents | A list of percentages of the budget to alert on when threshold is exceeded | list(number) | `<list>` | no |
| budget\_amount | The amount to use for a budget alert | number | `"null"` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/gsuite_enabled/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ module "project-factory" {
bucket_project = var.bucket_project
bucket_name = var.bucket_name
bucket_location = var.bucket_location
bucket_versioning = var.bucket_versioning
auto_create_network = var.auto_create_network
disable_services_on_destroy = var.disable_services_on_destroy
default_service_account = var.default_service_account
Expand Down
6 changes: 6 additions & 0 deletions modules/gsuite_enabled/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ variable "bucket_location" {
default = ""
}

variable "bucket_versioning" {
description = "Enable versioning for a GCS bucket to create (optional)"
type = bool
default = false
}

variable "api_sa_group" {
description = "A G Suite group to place the Google APIs Service Account for the project in"
default = ""
Expand Down
1 change: 1 addition & 0 deletions modules/shared_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module "project-factory" {
activate_apis = var.activate_apis
usage_bucket_name = var.usage_bucket_name
usage_bucket_prefix = var.usage_bucket_prefix
bucket_versioning = var.bucket_versioning
credentials_path = var.credentials_path
shared_vpc_subnets = var.shared_vpc_subnets
labels = var.labels
Expand Down
6 changes: 6 additions & 0 deletions modules/shared_vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ variable "bucket_location" {
default = "US"
}

variable "bucket_versioning" {
description = "Enable versioning for a GCS bucket to create (optional)"
type = bool
default = false
}

variable "auto_create_network" {
description = "Create the default network"
type = bool
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ variable "bucket_location" {
default = "US"
}

variable "bucket_versioning" {
description = "Enable versioning for a GCS bucket to create (optional)"
type = bool
default = false
}

variable "auto_create_network" {
description = "Create the default network"
type = bool
Expand Down