Add first-working deployment of bucket and CDN

This commit is contained in:
Shane Engelman 2023-01-29 12:31:47 -06:00
parent df0dfbbe84
commit 751cce19c5
Signed by: shane
GPG Key ID: D9DF703B83B9A9B5
2 changed files with 21 additions and 4 deletions

View File

@ -11,6 +11,16 @@ terraform {
} }
} }
provider "digitalocean" {
token = var.do_token
spaces_access_id = var.spaces_access_id
spaces_secret_key = var.spaces_secret
}
provider "acme" { provider "acme" {
server_url = "https://acme-v02.api.letsencrypt.org/directory" server_url = "https://acme-v02.api.letsencrypt.org/directory"
} }
variable "do_token" {}
variable "spaces_access_id" {}
variable "spaces_secret" {}

View File

@ -21,7 +21,7 @@ resource "local_file" "static_dir" {
} }
# Create local files as scratch space # Create local files as scratch space
resource "local_file" "example" { resource "local_file" "policy" {
filename = ".well-known/openpgpkey/policy" filename = ".well-known/openpgpkey/policy"
content = "" content = ""
depends_on = [local_file.openpgpkey] depends_on = [local_file.openpgpkey]
@ -40,12 +40,19 @@ resource "local_file" "example" {
# depends_on = [local_exec.command1] # depends_on = [local_exec.command1]
# } # }
# Create the Space on Digital Ocean # Create a new Spaces Bucket
resource "digitalocean_spaces_bucket" "distrust_co" { resource "digitalocean_spaces_bucket" "distrust_co" {
name = "distrust.co" name = "distrust-co"
region = "nyc3" region = "nyc3"
acl = "public-read"
} }
# Add a CDN endpoint to the Spaces Bucket
resource "digitalocean_cdn" "distrust_co" { resource "digitalocean_cdn" "distrust_co" {
origin = digitalocean_spaces_bucket.distrust_co.bucket_domain_name origin = digitalocean_spaces_bucket.distrust_co.bucket_domain_name
} }
# Output the endpoint for the CDN resource
output "fqdn" {
value = digitalocean_cdn.distrust_co.endpoint
}