version: 1
kind: component
meta:
  name: acme-certificate

requires:
  - terraform

parameters:
  - name: certificate.commonName
    env: TF_VAR_common_name
  - name: certificate.alternativeNames
    empty: allow
    env: TF_VAR_alternative_names
  - name: certificate.acme.email
    env: TF_VAR_email
    empty: allow
  - name: certificate.acme.endpoint
    env: TF_VAR_endpoint
    value: https://acme-v02.api.letsencrypt.org/directory
    brief: >
      Let's Encrypt has two endpoints
        1. production: https://acme-v02.api.letsencrypt.org/directory
        2. staging:    https://acme-staging-v02.api.letsencrypt.org/directory
outputs:
  - name: certificate.cert
    fromTfVar: cert_file
  - name: certificate.key
    fromTfVar: key_file
  - name: certificate.chain.cert
    fromTfVar: chain_file
  - name: certificate.google.selfLink
    fromTfVar: google_cert_selflink
