1
0
Fork 0
distrust-stack/website.tf

58 lines
1.6 KiB
HCL

# Upload files to Digital Ocean
## The Digital Ocean Spaces API is compatible with Amazon S3
# resource "local_exec" "s3cmd" {
# command = "s3cmd put --recursive --acl-public --guess-mime-type --verbose static/ s3://static-site/"
# depends_on = [local_file.index_html, local_file.static_dir]
# }
# Create local directories as scratch space
resource "local_file" "openpgpkey" {
filename = ".well-known/openpgpkey/policy"
content = ""
}
resource "local_file" "hu" {
filename = ".well-known/openpgpkey/hu/.keep"
content = ""
depends_on = [local_file.openpgpkey]
}
resource "local_file" "static_dir" {
filename = "static/.keep"
content = ""
}
# Create local files as scratch space
resource "local_file" "policy" {
filename = ".well-known/openpgpkey/policy"
content = ""
depends_on = [local_file.openpgpkey]
}
# # Execute commands required to fetch PGP keys
# resource "local_exec" "command1" {
# command = "command1 arg1 arg2"
# output = var.output1
# depends_on = [local_file.openpgpkey]
# }
# # Execute commands to build static site
# resource "local_exec" "command2" {
# command = "command2 ${var.output1} arg2"
# depends_on = [local_exec.command1]
# }
# Create a new Spaces Bucket
resource "digitalocean_spaces_bucket" "distrust_co" {
name = "distrust-co"
region = "nyc3"
acl = "public-read"
}
# Add a CDN endpoint to the Spaces Bucket
resource "digitalocean_cdn" "distrust_co" {
origin = digitalocean_spaces_bucket.distrust_co.bucket_domain_name
}
# Output the endpoint for the CDN resource
output "fqdn" {
value = digitalocean_cdn.distrust_co.endpoint
}