remind101 / stacker_blueprints

DEPRECATED - moved to:
https://github.com/cloudtools/stacker_blueprints
BSD 2-Clause "Simplified" License
39 stars 53 forks source link

Rout exception on build #142

Closed lecole closed 6 years ago

lecole commented 6 years ago

Reopen from Stacker issue:

I got this error using the latest released version and latest master version. Not exactly sure where to look to fix this issue. The same configuration and environment files worked two months ago.

[2017-09-17T12:09:25] INFO stacker.commands.stacker:32(configure): Using Default AWS Provider [2017-09-17T12:09:25] DEBUG stacker.plan:288(outline): Plan "Create/Update stacks": [2017-09-17T12:09:25] DEBUG stacker.plan:296(outline): - step: 1: target: "vdt-dev-vpc", action: "_launch_stack" [2017-09-17T12:09:25] DEBUG stacker.plan:296(outline): - step: 2: target: "vdt-dev-empireDB", action: "_launch_stack" [2017-09-17T12:09:25] DEBUG stacker.plan:296(outline): - step: 3: target: "vdt-dev-empireController", action: "_launch_stack" [2017-09-17T12:09:25] DEBUG stacker.plan:296(outline): - step: 4: target: "vdt-dev-bastion", action: "_launch_stack" [2017-09-17T12:09:25] DEBUG stacker.plan:296(outline): - step: 5: target: "vdt-dev-empireMinion", action: "_launch_stack" [2017-09-17T12:09:25] DEBUG stacker.plan:296(outline): - step: 6: target: "vdt-dev-empireDaemon", action: "_launch_stack" [2017-09-17T12:09:25] DEBUG stacker.actions.build:303(run): Launching stacks: vdt-dev-vpc, vdt-dev-empireDB, vdt-dev-empireController, vdt-dev-bastion, vdt-dev-empireMinion, vdt-dev-empireDaemon [2017-09-17T12:09:25] INFO stacker.plan:358(_check_point): Plan Status: [2017-09-17T12:09:25] INFO stacker.plan:380(_check_point): vdt-dev-vpc: pending [2017-09-17T12:09:25] INFO stacker.plan:380(_check_point): vdt-dev-empireDB: pending [2017-09-17T12:09:25] INFO stacker.plan:380(_check_point): vdt-dev-empireController: pending [2017-09-17T12:09:25] INFO stacker.plan:380(_check_point): vdt-dev-bastion: pending [2017-09-17T12:09:25] INFO stacker.plan:380(_check_point): vdt-dev-empireMinion: pending [2017-09-17T12:09:25] INFO stacker.plan:380(_check_point): vdt-dev-empireDaemon: pending [2017-09-17T12:09:25] DEBUG stacker.util:58(retry_with_backoff): Calling <bound method CloudFormation.describe_stacks of <botocore.client.CloudFormation object at 0x103c193d0>>, attempt 1. [2017-09-17T12:09:25] DEBUG stacker.actions.build:231(_launch_stack): Resolving stack vdt-dev-vpc [2017-09-17T12:09:25] DEBUG stacker.actions.build:234(_launch_stack): Launching stack vdt-dev-vpc now. [2017-09-17T12:09:25] DEBUG stacker.blueprints.base:448(import_mappings): Adding mapping AmiMap. [2017-09-17T12:09:25] DEBUG stacker.blueprints.base:369(setup_parameters): No parameters defined. Traceback (most recent call last): File "/Users//dev/projects/viditure/vt_env/bin/stacker", line 4, in import('pkg_resources').run_script('stacker==1.0.4', 'stacker') File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/pkg_resources/init.py", line 748, in run_script self.require(requires)[0].run_script(script_name, ns) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/pkg_resources/init.py", line 1524, in run_script exec(script_code, namespace, namespace) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/stacker-1.0.4-py2.7.egg/EGG-INFO/scripts/stacker", line 9, in

File "build/bdist.macosx-10.12-intel/egg/stacker/commands/stacker/build.py", line 52, in run File "build/bdist.macosx-10.12-intel/egg/stacker/actions/base.py", line 127, in execute File "build/bdist.macosx-10.12-intel/egg/stacker/actions/build.py", line 304, in run File "build/bdist.macosx-10.12-intel/egg/stacker/plan.py", line 267, in execute File "build/bdist.macosx-10.12-intel/egg/stacker/plan.py", line 227, in _single_run File "build/bdist.macosx-10.12-intel/egg/stacker/plan.py", line 74, in run File "build/bdist.macosx-10.12-intel/egg/stacker/actions/build.py", line 235, in _launch_stack File "build/bdist.macosx-10.12-intel/egg/stacker/actions/base.py", line 101, in s3_stack_push File "build/bdist.macosx-10.12-intel/egg/stacker/actions/base.py", line 25, in stack_template_key_name File "build/bdist.macosx-10.12-intel/egg/stacker/blueprints/base.py", line 491, in version File "build/bdist.macosx-10.12-intel/egg/stacker/blueprints/base.py", line 461, in render_template File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/init.py", line 609, in to_json return json.dumps(self.to_dict(), indent=indent, File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/init.py", line 606, in to_dict return encode_to_dict(t) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/init.py", line 63, in encode_to_dict props[name] = encode_to_dict(prop) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/init.py", line 63, in encode_to_dict props[name] = encode_to_dict(prop) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/init.py", line 54, in encode_to_dict return encode_to_dict(obj.to_dict()) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/init.py", line 226, in to_dict self.validate() File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/ec2.py", line 344, in validate exactly_one(self.class.name, self.properties, gateway_conds) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/validators.py", line 201, in exactly_one specified_count = mutually_exclusive(class_name, properties, conditionals) File "/Users//dev/projects/viditure/vt_env/lib/python2.7/site-packages/troposphere-1.9.5-py2.7.egg/troposphere/validators.py", line 196, in mutually_exclusive class_name, ', '.join(conditionals))) ValueError: Route: only one of the following can be specified: EgressOnlyInternetGatewayId, GatewayId, InstanceId, NatGatewayId, NetworkInterfaceId, VpcPeeringConnectionId

jseiser commented 6 years ago

I saw the same thing, the error is coming from the VPC blueprint, in this chunk of code.

                    # Private subnets are where actual instances will live
                    # so their gateway needs to be through the nat instances
                    if variables["UseNatGateway"]:
                        instance_id = NOVALUE
                        nat_gateway_id = Ref(NAT_GATEWAY_NAME % name_suffix)
                    else:
                        instance_id = Ref(NAT_INSTANCE_NAME % name_suffix)
                        nat_gateway_id = NOVALUE

                    t.add_resource(
                        ec2.Route(
                            route_name,
                            RouteTableId=Ref(route_table_name),
                            DestinationCidrBlock='0.0.0.0/0',
                            InstanceId=instance_id,
                            NatGatewayId=nat_gateway_id,
                        )
                    )

To get around it, I moved the route to be into the if/else. So if use natgateway, I built a route without the InstanceID, and vice versa.

lecole commented 6 years ago

Thanks @jseiser that workaround worked for me.

phobologic commented 6 years ago

Thanks @jseiser - btw, PRs gladly accepted :) Hint hint!