Created
June 27, 2014 17:46
-
-
Save carmstrong/bc1b46f344acbe623caa to your computer and use it in GitHub Desktop.
vpc.diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/contrib/ec2/README.md b/contrib/ec2/README.md | |
index 6bbf8e1..fc39338 100644 | |
--- a/contrib/ec2/README.md | |
+++ b/contrib/ec2/README.md | |
@@ -62,11 +62,12 @@ which is already filled out. The defaults will be applied for the other settings | |
## Choose whether to launch in VPC | |
-To launch you cluster into a VPC, export two additional environment variables: | |
+To launch your cluster into a VPC, export three additional environment variables: | |
``` | |
export VPC_ID=vpc-a26218bf | |
export VPC_SUBNETS=subnet-04d7f942,subnet-2b03ab7f | |
+export VPC_REGION=us-east-1 | |
``` | |
## Run the provision script | |
diff --git a/contrib/ec2/gen-json.py b/contrib/ec2/gen-json.py | |
index 61d1f15..e681a5c 100755 | |
--- a/contrib/ec2/gen-json.py | |
+++ b/contrib/ec2/gen-json.py | |
@@ -10,7 +10,7 @@ with open('../coreos/user-data','r') as f: | |
template['Resources']['CoreOSServerLaunchConfig']['Properties']['UserData']['Fn::Base64']['Fn::Join'] = [ '', lines ] | |
template['Parameters']['ClusterSize']['Default'] = str(os.getenv('DEIS_NUM_INSTANCES', 3)) | |
-if os.getenv("VPC_ID", None) and os.getenv("VPC_SUBNETS", None): | |
+if os.getenv('VPC_ID', None) and os.getenv('VPC_SUBNETS', None) and os.getenv('VPC_REGION', None): | |
for resource in template['Resources'].keys(): | |
resource_type = template['Resources'][resource]['Type'] | |
if resource_type == 'AWS::EC2::SecurityGroup': | |
@@ -25,6 +25,6 @@ if os.getenv("VPC_ID", None) and os.getenv("VPC_SUBNETS", None): | |
template['Resources'][resource]['Properties']['AssociatePublicIpAddress'] = False | |
elif resource_type == 'AWS::AutoScaling::AutoScalingGroup': | |
template['Resources'][resource]['Properties']['VPCZoneIdentifier'] = os.getenv('VPC_SUBNETS').split(',') | |
- | |
+ template['Resources'][resource]['Properties']['AvailabilityZones'] = { "Fn::GetAZs": os.getenv('VPC_REGION') } | |
print json.dumps(template) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment