AWSTemplateFormatVersion: "2010-09-09"
Description: >
  Creates a wildcard ACM certificate for the standard VPC created by the root
  stack (eg *.vpc-af124354.prx.tech)
Conditions:
  IsProduction: !Equals [!Ref EnvironmentType, Production]
Parameters:
  VPC:
     Type: "AWS::EC2::VPC::Id"
  EnvironmentType:
    Type: String
  EnvironmentTypeAbbreviation:
    Type: String
Resources:
  VpcWildcardCertificate:
    Type: "AWS::CertificateManager::Certificate"
    Properties:
      DomainName: !Sub "*.${EnvironmentTypeAbbreviation}-${VPC}.prx.tech"
      DomainValidationOptions:
        - ValidationDomain: prx.tech
          DomainName: !Sub "*.${EnvironmentTypeAbbreviation}-${VPC}.prx.tech"
      SubjectAlternativeNames:
        - "*.prx.org"
        - "*.prx.tech"
        - "*.staging.prx.tech"
      Tags:
        - Key: Project
          Value: platform.prx.org
        - Key: Environment
          Value: !Ref EnvironmentType
        - Key: Name
          Value: !Sub "${EnvironmentType} ${VPC} wildcard"
Outputs:
  WildcardCertificateArn:
    Description: The ARN for the wildcard certificate
    Value: !Ref VpcWildcardCertificate

AWSTemplateFormatVersion: "2010-09-09"
Description: >
  Creates a wildcard ACM certificate for the standard VPC created by the root
  stack (eg *.vpc-af124354.prx.tech)
Conditions:
  IsProduction: !Equals [!Ref EnvironmentType, Production]
Parameters:
  VPC:
     Type: "AWS::EC2::VPC::Id"
  EnvironmentType:
    Type: String
  EnvironmentTypeAbbreviation:
    Type: String
Resources:
  VpcWildcardCertificate:
    Type: "AWS::CertificateManager::Certificate"
    Properties:
      DomainName: !Sub "*.${EnvironmentTypeAbbreviation}-${VPC}.prx.tech"
      DomainValidationOptions:
        - ValidationDomain: prx.tech
          DomainName: !Sub "*.${EnvironmentTypeAbbreviation}-${VPC}.prx.tech"
      SubjectAlternativeNames:
        - "*.prx.org"
        - "*.prx.tech"
        - "*.staging.prx.tech"
        - !Sub "*.cdn.${EnvironmentTypeAbbreviation}-${VPC}.prx.tech"
      Tags:
        - Key: Project
          Value: platform.prx.org
        - Key: Environment
          Value: !Ref EnvironmentType
        - Key: Name
          Value: !Sub "${EnvironmentType} ${VPC} wildcard"
Outputs:
  WildcardCertificateArn:
    Description: The ARN for the wildcard certificate
    Value: !Ref VpcWildcardCertificate

Add CDN subdomain to wildcard cert
Add CDN subdomain to wildcard cert
