moto/tests/test_cloudformation/fixtures/redshift.py

180 lines
6.9 KiB
Python
Raw Normal View History

template = {
2017-02-24 02:37:43 +00:00
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"DatabaseName": {
"Description": "The name of the first database to be created when the cluster is created",
"Type": "String",
"Default": "dev",
2019-10-31 15:44:26 +00:00
"AllowedPattern": "([a-z]|[0-9])+",
2017-02-24 02:37:43 +00:00
},
"ClusterType": {
"Description": "The type of cluster",
"Type": "String",
"Default": "single-node",
2019-10-31 15:44:26 +00:00
"AllowedValues": ["single-node", "multi-node"],
2017-02-24 02:37:43 +00:00
},
"NumberOfNodes": {
"Description": "The number of compute nodes in the cluster. For multi-node clusters, the NumberOfNodes parameter must be greater than 1",
"Type": "Number",
2019-10-31 15:44:26 +00:00
"Default": "1",
2017-02-24 02:37:43 +00:00
},
"NodeType": {
"Description": "The type of node to be provisioned",
"Type": "String",
"Default": "dw1.xlarge",
2019-10-31 15:44:26 +00:00
"AllowedValues": ["dw1.xlarge", "dw1.8xlarge", "dw2.large", "dw2.8xlarge"],
2017-02-24 02:37:43 +00:00
},
"MasterUsername": {
"Description": "The user name that is associated with the master user account for the cluster that is being created",
"Type": "String",
"Default": "defaultuser",
2019-10-31 15:44:26 +00:00
"AllowedPattern": "([a-z])([a-z]|[0-9])*",
2017-02-24 02:37:43 +00:00
},
2019-10-31 15:44:26 +00:00
"MasterUserPassword": {
2017-02-24 02:37:43 +00:00
"Description": "The password that is associated with the master user account for the cluster that is being created.",
"Type": "String",
2019-10-31 15:44:26 +00:00
"NoEcho": "true",
2017-02-24 02:37:43 +00:00
},
"InboundTraffic": {
"Description": "Allow inbound traffic to the cluster from this CIDR range.",
"Type": "String",
"MinLength": "9",
"MaxLength": "18",
"Default": "0.0.0.0/0",
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
2019-10-31 15:44:26 +00:00
"ConstraintDescription": "must be a valid CIDR range of the form x.x.x.x/x.",
2017-02-24 02:37:43 +00:00
},
"PortNumber": {
"Description": "The port number on which the cluster accepts incoming connections.",
"Type": "Number",
2019-10-31 15:44:26 +00:00
"Default": "5439",
},
},
2017-02-24 02:37:43 +00:00
"Conditions": {
2019-10-31 15:44:26 +00:00
"IsMultiNodeCluster": {"Fn::Equals": [{"Ref": "ClusterType"}, "multi-node"]}
},
2017-02-24 02:37:43 +00:00
"Resources": {
"RedshiftCluster": {
"Type": "AWS::Redshift::Cluster",
"DependsOn": "AttachGateway",
"Properties": {
"ClusterType": {"Ref": "ClusterType"},
2019-10-31 15:44:26 +00:00
"NumberOfNodes": {
"Fn::If": [
"IsMultiNodeCluster",
{"Ref": "NumberOfNodes"},
{"Ref": "AWS::NoValue"},
]
},
2017-02-24 02:37:43 +00:00
"NodeType": {"Ref": "NodeType"},
"DBName": {"Ref": "DatabaseName"},
"MasterUsername": {"Ref": "MasterUsername"},
"MasterUserPassword": {"Ref": "MasterUserPassword"},
"ClusterParameterGroupName": {"Ref": "RedshiftClusterParameterGroup"},
"VpcSecurityGroupIds": [{"Ref": "SecurityGroup"}],
"ClusterSubnetGroupName": {"Ref": "RedshiftClusterSubnetGroup"},
"PubliclyAccessible": "true",
2019-10-31 15:44:26 +00:00
"Port": {"Ref": "PortNumber"},
},
2017-02-24 02:37:43 +00:00
},
"RedshiftClusterParameterGroup": {
"Type": "AWS::Redshift::ClusterParameterGroup",
"Properties": {
"Description": "Cluster parameter group",
"ParameterGroupFamily": "redshift-1.0",
2019-10-31 15:44:26 +00:00
"Parameters": [
{
"ParameterName": "enable_user_activity_logging",
"ParameterValue": "true",
}
],
},
2017-02-24 02:37:43 +00:00
},
"RedshiftClusterSubnetGroup": {
"Type": "AWS::Redshift::ClusterSubnetGroup",
"Properties": {
"Description": "Cluster subnet group",
2019-10-31 15:44:26 +00:00
"SubnetIds": [{"Ref": "PublicSubnet"}],
},
2017-02-24 02:37:43 +00:00
},
2019-10-31 15:44:26 +00:00
"VPC": {"Type": "AWS::EC2::VPC", "Properties": {"CidrBlock": "10.0.0.0/16"}},
2017-02-24 02:37:43 +00:00
"PublicSubnet": {
"Type": "AWS::EC2::Subnet",
2019-10-31 15:44:26 +00:00
"Properties": {"CidrBlock": "10.0.0.0/24", "VpcId": {"Ref": "VPC"}},
2017-02-24 02:37:43 +00:00
},
"SecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "Security group",
2019-10-31 15:44:26 +00:00
"SecurityGroupIngress": [
{
"CidrIp": {"Ref": "InboundTraffic"},
"FromPort": {"Ref": "PortNumber"},
"ToPort": {"Ref": "PortNumber"},
"IpProtocol": "tcp",
}
],
"VpcId": {"Ref": "VPC"},
},
2017-02-24 02:37:43 +00:00
},
2019-10-31 15:44:26 +00:00
"myInternetGateway": {"Type": "AWS::EC2::InternetGateway"},
2017-02-24 02:37:43 +00:00
"AttachGateway": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {"Ref": "VPC"},
2019-10-31 15:44:26 +00:00
"InternetGatewayId": {"Ref": "myInternetGateway"},
},
2017-02-24 02:37:43 +00:00
},
"PublicRouteTable": {
"Type": "AWS::EC2::RouteTable",
2019-10-31 15:44:26 +00:00
"Properties": {"VpcId": {"Ref": "VPC"}},
2017-02-24 02:37:43 +00:00
},
"PublicRoute": {
"Type": "AWS::EC2::Route",
"DependsOn": "AttachGateway",
"Properties": {
2019-10-31 15:44:26 +00:00
"RouteTableId": {"Ref": "PublicRouteTable"},
2017-02-24 02:37:43 +00:00
"DestinationCidrBlock": "0.0.0.0/0",
2019-10-31 15:44:26 +00:00
"GatewayId": {"Ref": "myInternetGateway"},
},
2017-02-24 02:37:43 +00:00
},
"PublicSubnetRouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
2019-10-31 15:44:26 +00:00
"SubnetId": {"Ref": "PublicSubnet"},
"RouteTableId": {"Ref": "PublicRouteTable"},
},
},
},
2017-02-24 02:37:43 +00:00
"Outputs": {
"ClusterEndpoint": {
"Description": "Cluster endpoint",
2019-10-31 15:44:26 +00:00
"Value": {
"Fn::Join": [
":",
[
{"Fn::GetAtt": ["RedshiftCluster", "Endpoint.Address"]},
{"Fn::GetAtt": ["RedshiftCluster", "Endpoint.Port"]},
],
]
},
2017-02-24 02:37:43 +00:00
},
"ClusterName": {
"Description": "Name of cluster",
2019-10-31 15:44:26 +00:00
"Value": {"Ref": "RedshiftCluster"},
2017-02-24 02:37:43 +00:00
},
"ParameterGroupName": {
"Description": "Name of parameter group",
2019-10-31 15:44:26 +00:00
"Value": {"Ref": "RedshiftClusterParameterGroup"},
2017-02-24 02:37:43 +00:00
},
"RedshiftClusterSubnetGroupName": {
"Description": "Name of cluster subnet group",
2019-10-31 15:44:26 +00:00
"Value": {"Ref": "RedshiftClusterSubnetGroup"},
2017-02-24 02:37:43 +00:00
},
"RedshiftClusterSecurityGroupName": {
"Description": "Name of cluster security group",
2019-10-31 15:44:26 +00:00
"Value": {"Ref": "SecurityGroup"},
},
},
2017-02-24 02:37:43 +00:00
}