variable "alicloud_access_key"{type=string}
variable "alicloud_secret_key"{type=string}
provider "acme" {
server_url = "https://acme-v02.api.letsencrypt.org/directory"
}
resource "tls_private_key" "any_wener_me_private_key" {
algorithm = "RSA"
}
resource "acme_registration" "any_wener_me_reg" {
account_key_pem = "${tls_private_key.any_wener_me_private_key.private_key_pem}"
email_address = "admin@wener.me"
}
resource "acme_certificate" "any_wener_me" {
account_key_pem = "${acme_registration.any_wener_me_reg.account_key_pem}"
common_name = "wener.me"
subject_alternative_names = ["*.wener.me"]
dns_challenge {
provider = "alidns"
config = {
ALICLOUD_ACCESS_KEY = var.alicloud_access_key
ALICLOUD_SECRET_KEY = var.alicloud_secret_key
}
}
}
resource "local_file" "any_wener_me_crt" {
sensitive_content = acme_certificate.any_wener_me.certificate_pem
filename = "${path.module}/wener.me.crt"
file_permission = 0600
}
resource "local_file" "any_wener_me_key" {
sensitive_content = acme_certificate.any_wener_me.private_key_pem
filename = "${path.module}/wener.me.key"
file_permission = 0600
}