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

Commit

Permalink
Merge pull request #73 from ministryofjustice/custom-vpc
Browse files Browse the repository at this point in the history
Make the VPC configurable from with the YAML file
  • Loading branch information
mattmb committed Apr 13, 2015
2 parents 36cf70c + 976d69d commit 8b3241b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 97 deletions.
90 changes: 1 addition & 89 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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.

::

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
Expand Down
2 changes: 2 additions & 0 deletions bootstrap_cfn/config.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 8b3241b

Please sign in to comment.