wip: dir organisation, script cleanup
This commit is contained in:
36
modules/published-dots/main.tf
Normal file
36
modules/published-dots/main.tf
Normal file
@@ -0,0 +1,36 @@
|
||||
# Static bucket
|
||||
resource "google_storage_bucket" "bucket" {
|
||||
provider = google-beta
|
||||
|
||||
project = var.project
|
||||
|
||||
name = var.domain
|
||||
location = "EU"
|
||||
storage_class = "MULTI_REGIONAL"
|
||||
|
||||
versioning {
|
||||
enabled = var.enable_versioning
|
||||
}
|
||||
}
|
||||
|
||||
# Allow public read
|
||||
resource "google_storage_default_object_acl" "bucket_acl" {
|
||||
provider = google-beta
|
||||
bucket = google_storage_bucket.bucket.name
|
||||
role_entity = ["READER:allUsers"]
|
||||
}
|
||||
|
||||
# DNS entry
|
||||
resource "google_dns_record_set" "cname" {
|
||||
provider = google-beta
|
||||
|
||||
depends_on = [google_storage_bucket.bucket]
|
||||
|
||||
project = var.project
|
||||
|
||||
name = "${var.domain}."
|
||||
managed_zone = var.dns_zone
|
||||
type = "CNAME"
|
||||
ttl = 300
|
||||
rrdatas = ["c.storage.googleapis.com."]
|
||||
}
|
||||
7
modules/published-dots/outputs.tf
Normal file
7
modules/published-dots/outputs.tf
Normal file
@@ -0,0 +1,7 @@
|
||||
output "bucket_url" {
|
||||
value = "storage.googleapis.com/${var.domain}"
|
||||
}
|
||||
|
||||
output "bucket_link" {
|
||||
value = google_storage_bucket.bucket.self_link
|
||||
}
|
||||
14
modules/published-dots/variables.tf
Normal file
14
modules/published-dots/variables.tf
Normal file
@@ -0,0 +1,14 @@
|
||||
variable "project" {
|
||||
description = "Google Cloud project to host resources in"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "domain" {
|
||||
description = "DNS name to serve static content"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "dns_zone" {
|
||||
description = "Cloud DNS zone to use"
|
||||
type = string
|
||||
}
|
||||
Reference in New Issue
Block a user