Description: CloudFormation template for creating Simple AD Server
Outputs:
  SimpleADDomainID:
    Description: ID of the newly Created SimpleAD
    Value: !Ref 'EmrSimpleAD'
  SimpleADIPAddress:
    Description: IP addresses of newly Created SimpleAD
    Value: !Select
      - '1'
      - !GetAtt 'EmrSimpleAD.DnsIpAddresses'
Parameters:
  DomainName:
    Default: corp.emr.local
    Description: DomainName
    AllowedValues:
      - corp.emr.local
    Type: String
  DomainPassword:
    Description: DomainPassword
    Type: String
  DomainShortName:
    Default: EmrSimpleAD
    Description: DomainShortName
    Type: String
  Subnet1SimpleAD:
    Description: Subnet ID1 for creating the SimpleAD
    Type: AWS::EC2::Subnet::Id
  Subnet2SimpleAD:
    Description: Subnet ID2 for creating the SimpleAD
    Type: AWS::EC2::Subnet::Id
  VPC:
    Description: VPC ID for creating the EMR cluster
    Type: AWS::EC2::VPC::Id
Resources:
  EmrSimpleAD:
    Properties:
      CreateAlias: 'false'
      Description: Simple AD Directory
      Name: !Ref 'DomainName'
      Password: !Ref 'DomainPassword'
      ShortName: !Ref 'DomainShortName'
      Size: Small
      VpcSettings:
        SubnetIds:
          - !Ref 'Subnet1SimpleAD'
          - !Ref 'Subnet2SimpleAD'
        VpcId: !Ref 'VPC'
    Type: AWS::DirectoryService::SimpleAD
