Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Make the VPC configurable from with the YAML file
Browse files Browse the repository at this point in the history
If no VPC is specified in the YAML config, it will default to
10.0.0.0/16.

Also updated the sample-project.yaml to include this change, and instead
of copy/pasting the sample yaml to the README, we now link to it
directly.
  • Loading branch information
stuartornum committed Apr 13, 2015
1 parent 78707b7 commit ba9444d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 98 deletions.
91 changes: 1 addition & 90 deletions README.rst
Expand Up @@ -76,96 +76,7 @@ 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.

::

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: 10
- 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
The `YAML file <https://github.com/ministryofjustice/bootstrap-cfn/blob/master/docs/sample-project.yaml>`_ 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.


Salt specific configuration
Expand Down
2 changes: 2 additions & 0 deletions bootstrap_cfn/config.py
Expand Up @@ -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:
Expand Down
22 changes: 14 additions & 8 deletions 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
Expand All @@ -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.
Expand Down

0 comments on commit ba9444d

Please sign in to comment.