A swamp extension model for managing Let's Encrypt TLS certificates using DNS-01 challenges.
- swamp installed
- Ability to create DNS TXT records for your domain (the model logs the required records and polls until they appear)
-
Install the extension in your swamp project:
swamp extension pull @stack72/letsencrypt-certificate
-
Create a vault for storing sensitive data (account keys, certificate private keys):
swamp vault create local_encryption default
-
Create a model instance:
swamp model create @stack72/letsencrypt-certificate my-cert
-
Edit the generated input YAML (
swamp model edit my-cert) with your domain and email:globalArguments: domain: "example.com" altNames: [] email: "admin@example.com" staging: true methods: create: arguments: {} status: arguments: {} renew: arguments: {} revoke: arguments: {}
Set
staging: falsewhen you're ready to issue real certificates from Let's Encrypt production.
swamp model method run my-cert create --verboseThis will:
-
Generate an ACME account key and register with Let's Encrypt
-
Create a certificate order for your domain
-
Log the DNS TXT record you need to create, e.g.:
Create TXT record: _acme-challenge.example.com → "abc123..." -
Poll DNS every 10 seconds (up to 10 minutes) until the record is found
-
Complete the challenge, generate a CSR, and download the signed certificate
-
Store the account and certificate data (private keys go to the vault)
swamp model method run my-cert status --verboseReports the certificate expiry date, days remaining, and whether renewal is needed (< 30 days).
swamp model method run my-cert renew --verboseUses the existing ACME account to request a new certificate. Same DNS-01 challenge flow as create — you'll need to update the TXT record with the new value.
swamp model method run my-cert revoke --verboseRevokes the certificate via the ACME protocol.
| Argument | Type | Default | Description |
|---|---|---|---|
domain |
string |
— | Primary domain for the certificate |
altNames |
string[] |
[] |
Additional Subject Alternative Names |
email |
string |
— | Contact email for the ACME account |
staging |
boolean |
true |
Use Let's Encrypt staging vs production |
| Resource | Fields |
|---|---|
account |
accountUrl, accountKey (sensitive) |
certificate |
domain, certificate, chain, privateKey (sensitive), expiry, issuedAt |
Access stored data via CEL expressions:
${{ data.latest("my-cert", "certificate").attributes.domain }}
${{ data.latest("my-cert", "certificate").attributes.expiry }}