envato / cloudformation_rspec

Test your CloudFormation templates
MIT License
10 stars 0 forks source link

Print out the logical resource ids of matching resource types #2

Closed patrobinson closed 6 years ago

patrobinson commented 6 years ago

When setting up these tests I found it hard to determine what the names are meant to be for my resources. The current output is not very helpful:

  1) vpc_template public subnets creates a route table and association
     Failure/Error: expect(stack).to contain_in_change_set("AWS::EC2::SubnetRouteTableAssociation", "MyAwesomeVpcYouShouldTotallyChangeThisPublicSubnetsRouteTableRouteTableAssociation")
       Change set does not include a resource type AWS::EC2::SubnetRouteTableAssociation with the id MyAwesomeVpcYouShouldTotallyChangeThisPublicSubnetsRouteTableRouteTableAssociation

Instead we should output all the resource names with the same resource type, to give us a handy hint:

  1) vpc_template public subnets creates a route table and association
     Failure/Error: expect(stack).to contain_in_change_set("AWS::EC2::SubnetRouteTableAssociation", "MyAwesomeVpcYouShouldTotallyChangeThisPublicSubnetsRouteTableRouteTableAssociation")

       Change set does not include a resource type AWS::EC2::SubnetRouteTableAssociation with the id MyAwesomeVpcYouShouldTotallyChangeThisPublicSubnetsRouteTableRouteTableAssociation
       Found the following resources with the same Resource Type:
       MyAwesomeVpcYouShouldTotallyChangeThisPrivateSubnet0RouteTableAssociation
       MyAwesomeVpcYouShouldTotallyChangeThisPrivateSubnet1RouteTableAssociation
       MyAwesomeVpcYouShouldTotallyChangeThisPublicSubnet0RouteTableAssociation
       MyAwesomeVpcYouShouldTotallyChangeThisPublicSubnet1RouteTableAssociation