Skip to content

Commit

Permalink
extract network into module
Browse files Browse the repository at this point in the history
  • Loading branch information
koenighotze committed May 3, 2024
1 parent 664ddf6 commit 62badcd
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 19 deletions.
6 changes: 0 additions & 6 deletions getting-started/08/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ locals {

firewall_target_tags = ["webserver"]

website_bucket_name = lower("website-${local.name_postfix}")
website_content = [
"index.html",
"404.html"
]

default_labels = {
purpose = "gcp-terraform-training"
gettingstarted = local.name_postfix
Expand Down
2 changes: 1 addition & 1 deletion getting-started/08/modules/website/bucket.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "google_storage_bucket" "websitecontent" {
#checkov:skip=CKV_GCP_62: No logging needed
name = var.website_bucket_name
name = lower("website-${var.name_postfix}")
location = var.region
# we do not use object level ACLs
uniform_bucket_level_access = true
Expand Down
8 changes: 2 additions & 6 deletions getting-started/08/modules/website/variables.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
variable "website_bucket_name" {
description = "The name of the bucket to store the website content"
variable "name_postfix" {
description = "A postfix to append to the name of the resources"
type = string
validation {
condition = can(regex("^[a-z0-9][a-z0-9-.]{1,61}[a-z0-9]$", var.website_bucket_name))
error_message = "The website_bucket_name must start and end with a lowercase letter or number, and only contain lowercase letters, numbers, and dashes. It must be between 3 and 63 characters."
}
}

variable "region" {
Expand Down
5 changes: 0 additions & 5 deletions getting-started/08/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ variable "sa_email" {
}
}

variable "rebuild_mig" {
type = bool
default = false
}

variable "mig_pool_size" {
type = number
default = 2
Expand Down
2 changes: 1 addition & 1 deletion getting-started/08/website.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module "website" {

region = var.region
instance_service_account_email = google_service_account.instance_service_account.email
website_bucket_name = "website"
name_postfix = local.name_postfix
}

0 comments on commit 62badcd

Please sign in to comment.