---
AWSTemplateFormatVersion: "2010-09-09"
Description: >
  Good Template for testing Password Parameters
Parameters:
  MyPassword:
    Type: String
    Default: String
    Description: String
    NoEcho: True
  Environment:
    Type: String
    Default: "Dev"
Resources:
  MyDB:
    Type: AWS::RDS::DBInstance
    Properties:
      AllocatedStorage: '5'
      DBInstanceClass: db.m1.small
      Engine: MySQL
      MasterUsername: MyName
      MasterUserPassword: !Ref MyPassword
    DeletionPolicy: Snapshot
  myNewDb:
    Type: AWS::RDS::DBInstance
    Properties:
      AllocatedStorage: '5'
      DBInstanceClass: db.m1.small
      Engine: MySQL
      MasterUsername: MyName
      MasterUserPassword: '{{resolve:ssm-secure:MySecurePassword:1}}'
    DeletionPolicy: Snapshot
  myThirdDb:
    Type: AWS::RDS::DBInstance
    Properties:
      AllocatedStorage: '5'
      DBInstanceClass: db.m1.small
      Engine: MySQL
      MasterUsername: MyName
      MasterUserPassword: 'Prefix-{{resolve:ssm-secure:MySecurePassword:1}}-Postfix'
    DeletionPolicy: Snapshot
  MyIAMUser:
    Type: AWS::IAM::User
    Properties:
      UserName: !Sub ${Environment}-{{resolve:ssm:MyUsername:1}}
      LoginProfile:
        Password: !Sub 'list-{{resolve:ssm-secure:MySecurePassword:1}}'
