---
AWSTemplateFormatVersion: '2010-09-09'
Description: TLS Certificate from ACM deployed in us-east-1

Parameters:
  DomainName:
    Type: String
    Description: The hostname for the certificate 
    Default: enteryourdomainhere.com

  HostedZoneId:
    Type: String
    Description: The ID of the existing Route 53 Hosted Zone
   
Resources:
  Certificate:
    Type: AWS::CertificateManager::Certificate
    Properties:
      DomainName: !Ref DomainName
      ValidationMethod: DNS
      DomainValidationOptions:
        - DomainName: !Ref DomainName
          HostedZoneId: !Ref HostedZoneId
        - DomainName: !Sub www.${DomainName}
          HostedZoneId: !Ref HostedZoneId
      SubjectAlternativeNames:
        - !Sub www.${DomainName}

Outputs:
  CertificateArn:
    Description: The ARN of the certificate
    Value: !Ref Certificate