UNPKG

@grucloud/module-aws-certificate

Version:

provides an AWS SSL certificate and the associated Route53 resources to validate the certificate

39 lines (35 loc) 1.08 kB
const assert = require("assert"); const { retryCall } = require("@grucloud/core").Retry; module.exports = ({ resources, provider }) => { const { config } = provider; assert(config.certificate); const { rootDomainName } = config.certificate; assert(rootDomainName); const { hostedZone, certificate } = resources; assert(hostedZone); assert(certificate); assert(certificate.certificateRecordValidation); return { onDeployed: { init: async () => { const hostedZoneLive = await hostedZone.getLive(); return { hostedZoneLive }; }, actions: [ { name: `ssl certificate ready`, command: async () => { await retryCall({ name: `getting certificate status`, fn: () => certificate.certificate.getLive(), isExpectedResult: (sslCertificateLive) => { return sslCertificateLive.Status == "ISSUED"; }, config: { retryCount: 500, retryDelay: 5e3 }, }); }, }, ], }, }; };