diff --git a/README.rst b/README.rst index 47808a5..7c9fa3b 100644 --- a/README.rst +++ b/README.rst @@ -76,96 +76,8 @@ This tool needs AWS credentials to create stacks and the credentials should be p Project specific YAML file +++++++++++++++++++++++++++ -The YAML file below highlights what is possible with all the bootstrap-cfn features available to date. The minimum requirement is that it must contain an *ec2* block, you **do not** have to use RDS, S3 or ELB's. Block devices in EC2 block is non mandatory as well. If no block devices specified, default root device with 20GB space will be created. +The `YAML file `_ highlights what is possible with all the bootstrap-cfn features available to date. The minimum requirement is that it must contain an *ec2* block, you **do not** have to use RDS, S3 or ELB's. -:: - - dev: - ec2: - auto_scaling: - desired: 1 - max: 3 - min: 0 - tags: - Role: docker - Apps: test - Env: dev - parameters: - KeyName: default - InstanceType: t2.micro - block_devices: - - DeviceName: /dev/sda1 - VolumeSize: 20 - - DeviceName: /dev/sdf - VolumeSize: 10 - security_groups: - MySecGroup: - - IpProtocol: tcp - FromPort: 22 - ToPort: 22 - CidrIp: 0.0.0.0/0 - - IpProtocol: tcp - FromPort: 80 - ToPort: 80 - CidrIp: 0.0.0.0/0 - elb: - - name: test-dev-external - hosted_zone: my.domain.com. - scheme: internet-facing - listeners: - - LoadBalancerPort: 80 - InstancePort: 80 - Protocol: TCP - - LoadBalancerPort: 443 - InstancePort: 443 - Protocol: TCP - - name: test-dev-internal - hosted_zone: my.domain.com. - scheme: internet-facing - security_groups: - ELBSecGroup: - - IpProtocol: tcp - FromPort: 80 - ToPort: 80 - CidrIp: 10.0.0.0/0 - listeners: - - LoadBalancerPort: 80 - InstancePort: 80 - Protocol: TCP - s3: - static-bucket-name: moj-test-dev-static - rds: - storage: 5 - storage-type: gp2 - backup-retention-period: 1 - identifier: test-dev - db-name: test - db-master-username: testuser - db-master-password: testpassword - instance-class: db.t2.micro - multi-az: false - db-engine: postgres - db-engine-version: 9.3.5 - ssl: - my-cert: - cert: | - -----BEGIN CERTIFICATE----- - blahblahblah - -----END CERTIFICATE----- - key: | - -----BEGIN RSA PRIVATE KEY----- - blahblahblah - -----END RSA PRIVATE KEY----- - chain: | - -----BEGIN CERTIFICATE----- - blahblahblah - -----END CERTIFICATE----- - salt: - local_salt_dir: ./salt - local_pillar_dir: ./pillar - local_vendor_dir: ./vendor - remote_state_dir: /srv/salt - remote_pillar_dir: /srv/pillar Salt specific configuration diff --git a/bootstrap_cfn/config.py b/bootstrap_cfn/config.py index 31b01d4..6dc3583 100644 --- a/bootstrap_cfn/config.py +++ b/bootstrap_cfn/config.py @@ -86,6 +86,8 @@ def process(self): data[k] = v template = json.loads(pkgutil.get_data('bootstrap_cfn', 'stacks/base.json')) + if 'vpc' in self.data: + template['Mappings']['SubnetConfig']['VPC'] = self.data['vpc'] template['Resources'] = data template['Outputs'] = {} for t in output_templates: diff --git a/docs/sample-project.yaml b/docs/sample-project.yaml index 6605fe0..f35f2c9 100644 --- a/docs/sample-project.yaml +++ b/docs/sample-project.yaml @@ -1,4 +1,9 @@ dev: + vpc: + CIDR: 10.0.0.0/16 + SubnetA: 10.0.0.0/20 + SubnetB: 10.0.16.0/20 + SubnetC: 10.0.32.0/20 ec2: auto_scaling: desired: 1 @@ -17,14 +22,15 @@ dev: - DeviceName: /dev/sdf VolumeSize: 10 security_groups: - - IpProtocol: tcp - FromPort: 22 - ToPort: 22 - CidrIp: 0.0.0.0/0 - - IpProtocol: tcp - FromPort: 80 - ToPort: 80 - CidrIp: 0.0.0.0/0 + BaseSG: + - IpProtocol: tcp + FromPort: 22 + ToPort: 22 + CidrIp: 0.0.0.0/0 + - IpProtocol: tcp + FromPort: 80 + ToPort: 80 + CidrIp: 0.0.0.0/0 elb: - name: test-dev-external hosted_zone: kyrtest.pf.dsd.io.