wip: dir organisation, script cleanup

This commit is contained in:
Andrejus
2021-04-09 22:04:33 +01:00
parent 576c73352c
commit 18689abd73
59 changed files with 508 additions and 647 deletions

View 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."]
}

View File

@@ -0,0 +1,7 @@
output "bucket_url" {
value = "storage.googleapis.com/${var.domain}"
}
output "bucket_link" {
value = google_storage_bucket.bucket.self_link
}

View 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
}