jdormit
23bf44120b
Consolidated SSH keys definitions by removing redundant entries and moving a key to a more appropriate resource. Updated SSH service configuration for improved security and management. Applied changes to Packer build, including updating the OS version to Ubuntu 24-04 and configuring SSH and necessary dependencies. Adjusted certbot-renew service and related Packer scripts.
45 lines
1.4 KiB
HCL
45 lines
1.4 KiB
HCL
provider "digitalocean" {
|
|
token = var.do_token
|
|
spaces_access_id = var.spaces_access_id
|
|
spaces_secret_key = var.spaces_secret_key
|
|
}
|
|
|
|
data "terraform_remote_state" "do_ssh_keys" {
|
|
backend = "s3"
|
|
|
|
config = {
|
|
skip_credentials_validation = true
|
|
skip_metadata_api_check = true
|
|
access_key = var.spaces_access_id
|
|
secret_key = var.spaces_secret_key
|
|
region = "us-east-1"
|
|
endpoint = "nyc3.digitaloceanspaces.com"
|
|
bucket = "jdormit-tf-state"
|
|
key = "mgmt/do-ssh-keys.tfstate"
|
|
}
|
|
}
|
|
|
|
data "local_file" "packer_manifest" {
|
|
filename = "${path.root}/${var.packer_manifest}"
|
|
}
|
|
|
|
locals {
|
|
packer_manifest = jsondecode(data.local_file.packer_manifest.content)
|
|
packer_builds = local.packer_manifest.builds
|
|
packer_image_str = element(local.packer_builds, length(local.packer_builds) - 1).artifact_id
|
|
packer_image = split(":", local.packer_image_str)[1]
|
|
}
|
|
|
|
resource "digitalocean_droplet" "droplet" {
|
|
name = var.name
|
|
image = local.packer_image
|
|
region = var.region
|
|
size = var.droplet_size
|
|
backups = var.backups
|
|
tags = var.tags
|
|
ssh_keys = [
|
|
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_laptop_ssh_key_id,
|
|
data.terraform_remote_state.do_ssh_keys.outputs.jdormit_macbook_ssh_key_id,
|
|
]
|
|
}
|