Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ChangeSets to cloudformation_info + updates #64571

Merged
merged 18 commits into from
Dec 18, 2019
Merged

Add ChangeSets to cloudformation_info + updates #64571

merged 18 commits into from
Dec 18, 2019

Conversation

waffie1
Copy link
Contributor

@waffie1 waffie1 commented Nov 7, 2019

Add ability to retrieve stack change sets
Update module to use AnsibleAWSModule
Update backoff to use new decorator style
Updated exceptions to use fail_json_aws
Converted outputs to snake_case where appropriate, for cloudformation_info only to preserve cloudformation_facts functionality.
Unconverted keys are stack_outputs, stack_parameters, stack_policy,
stack_resources, stack_tags and stack_template

SUMMARY

Added the ability to retrieve stack change sets which will allow me to display details and handle approval/execute from an external pipeline tool.

While I was in there, I made updated many sections of the module according to the latest guidelines. Changes include:
Update module to use AnsibleAWSModule
Update backoff to use new decorator style
Updated exceptions to use fail_json_aws
Converted outputs to snake_case where appropriate, for cloudformation_info only to preserve cloudformation_facts functionality.
Unconverted keys are stack_outputs, stack_parameters, stack_policy,
stack_resources, stack_tags and stack_template

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

cloudformation_info

ADDITIONAL INFORMATION

BEFORE:

ok: [localhost] => {
    "msg": {
        "stack_description": {
            "capabilities": [
                "CAPABILITY_IAM",
                "CAPABILITY_NAMED_IAM"
            ],
            "creation_time": "2019-09-24T13:41:35.277000+00:00",
            "description": "Testing Ansible Changesets",
            "disable_rollback": false,
            "drift_information": {
                "stack_drift_status": "NOT_CHECKED"
            },
            "enable_termination_protection": false,
            "notification_arns": [],
            "outputs": [
                {
                    "output_key": "Role1",
                    "output_value": "Test"
                }
            ],
            "rollback_configuration": {},
            "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
            "stack_name": "TestStack",
            "stack_status": "CREATE_COMPLETE",
            "tags": []
        },
        "stack_events": [
            {
                "ClientRequestToken": "6d4a833a-1932-47bf-b280-f75561075968",
                "EventId": "1796ca00-ded1-11e9-86ad-0a009cdf2216",
                "LogicalResourceId": "TestStack",
                "PhysicalResourceId": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
                "ResourceStatus": "CREATE_COMPLETE",
                "ResourceType": "AWS::CloudFormation::Stack",
                "StackId": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
                "StackName": "TestStack",
                "Timestamp": "2019-09-24T13:42:03.671000+00:00"
            },
            {
                "ClientRequestToken": "6d4a833a-1932-47bf-b280-f75561075968",
                "EventId": "IamRole1-CREATE_COMPLETE-2019-09-24T13:42:01.286Z",
                "LogicalResourceId": "IamRole1",
                "PhysicalResourceId": "Test",
                "ResourceProperties": "{\"Path\":\"/\",\"RoleName\":\"Test\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\",\"ssm:GetParameters\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                "ResourceStatus": "CREATE_COMPLETE",
                "ResourceType": "AWS::IAM::Role",
                "StackId": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
                "StackName": "TestStack",
                "Timestamp": "2019-09-24T13:42:01.286000+00:00"
            },
            {
                "ClientRequestToken": "6d4a833a-1932-47bf-b280-f75561075968",
                "EventId": "IamRole1-CREATE_IN_PROGRESS-2019-09-24T13:41:38.395Z",
                "LogicalResourceId": "IamRole1",
                "PhysicalResourceId": "Test",
                "ResourceProperties": "{\"Path\":\"/\",\"RoleName\":\"Test\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\",\"ssm:GetParameters\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                "ResourceStatus": "CREATE_IN_PROGRESS",
                "ResourceStatusReason": "Resource creation Initiated",
                "ResourceType": "AWS::IAM::Role",
                "StackId": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
                "StackName": "TestStack",
                "Timestamp": "2019-09-24T13:41:38.395000+00:00"
            },
            {
                "ClientRequestToken": "6d4a833a-1932-47bf-b280-f75561075968",
                "EventId": "IamRole1-CREATE_IN_PROGRESS-2019-09-24T13:41:37.898Z",
                "LogicalResourceId": "IamRole1",
                "PhysicalResourceId": "",
                "ResourceProperties": "{\"Path\":\"/\",\"RoleName\":\"Test\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\",\"ssm:GetParameters\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                "ResourceStatus": "CREATE_IN_PROGRESS",
                "ResourceType": "AWS::IAM::Role",
                "StackId": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
                "StackName": "TestStack",
                "Timestamp": "2019-09-24T13:41:37.898000+00:00"
            },
            {
                "ClientRequestToken": "6d4a833a-1932-47bf-b280-f75561075968",
                "EventId": "06a81280-ded1-11e9-a808-0e194fb09f5c",
                "LogicalResourceId": "TestStack",
                "PhysicalResourceId": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
                "ResourceStatus": "CREATE_IN_PROGRESS",
                "ResourceStatusReason": "User Initiated",
                "ResourceType": "AWS::CloudFormation::Stack",
                "StackId": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/06a77640-ded1-11e9-a808-0e194fb09f5c",
                "StackName": "TestStack",
                "Timestamp": "2019-09-24T13:41:35.277000+00:00"
            }
        ],
        "stack_outputs": {
            "Role1": "Test"
        },
        "stack_parameters": {},
        "stack_policy": {},
        "stack_resource_list": [
            {
                "DriftInformation": {
                    "StackResourceDriftStatus": "NOT_CHECKED"
                },
                "LastUpdatedTimestamp": "2019-09-24T13:42:01.286000+00:00",
                "LogicalResourceId": "IamRole1",
                "PhysicalResourceId": "Test",
                "ResourceStatus": "CREATE_COMPLETE",
                "ResourceType": "AWS::IAM::Role"
            }
        ],
        "stack_resources": {
            "IamRole1": "Test"
        },
        "stack_tags": {},
        "stack_template": "AWSTemplateFormatVersion: 2010-09-09\nDescription: Testing Ansible Changesets\nResources:\n  IamRole1:\n    Type: AWS::IAM::Role\n    Properties:\n      RoleName: Test\n      AssumeRolePolicyDocument:\n        Version: '2012-10-17'\n        Statement:\n          - Effect: Allow\n            Principal:\n              Service: lambda.amazonaws.com\n            Action: sts:AssumeRole\n      Path: /\n      Policies:\n      - PolicyName: parameter-store-permissions\n        PolicyDocument:\n          Statement:\n            - Action:\n                - ssm:GetParametersByPath\n                - ssm:GetParameters\n              Effect: Allow\n              Resource: '*'\n#  IamRole2:\n#    Type: AWS::IAM::Role\n#    Properties:\n#      RoleName: Test2\n#      AssumeRolePolicyDocument:\n#        Version: '2012-10-17'\n#        Statement:\n#          - Effect: Allow\n#            Principal:\n#              Service: lambda.amazonaws.com\n#            Action: sts:AssumeRole\n#      Path: /\n#      Policies:\n#      - PolicyName: parameter-store-permissions\n#        PolicyDocument:\n#          Statement:\n#            - Action:\n#                - ssm:GetParametersByPath\n#                - ssm:GetParameters\n#              Effect: Allow\n#              Resource: '*'\n\nOutputs:\n  Role1:\n    Value: !Ref IamRole1\n      \n"
    }
}

AFTER:

ok: [localhost] => {
    "msg": {
        "TestStack": {
            "stack_change_sets": [
                {
                    "capabilities": [
                        "CAPABILITY_IAM",
                        "CAPABILITY_NAMED_IAM"
                    ],
                    "change_set_id": "arn:aws:cloudformation:us-east-1:012345678901:changeSet/Ansible-TestStack-635dfd5423c59b64819c69e24a41861000387415/7908e2ff-cb27-4786-b244-418d17a9c578",
                    "change_set_name": "Ansible-TestStack-635dfd5423c59b64819c69e24a41861000387415",
                    "changes": [
                        {
                            "resource_change": {
                                "action": "Remove",
                                "details": [],
                                "logical_resource_id": "IamRole2",
                                "physical_resource_id": "Test2",
                                "resource_type": "AWS::IAM::Role",
                                "scope": []
                            },
                            "type": "Resource"
                        },
                        {
                            "resource_change": {
                                "action": "Add",
                                "details": [],
                                "logical_resource_id": "IamRole3",
                                "resource_type": "AWS::IAM::Role",
                                "scope": []
                            },
                            "type": "Resource"
                        }
                    ],
                    "creation_time": "2019-09-30T17:43:16.663000+00:00",
                    "description": null,
                    "execution_status": "AVAILABLE",
                    "notification_arns": [],
                    "parameters": null,
                    "rollback_configuration": {
                        "rollback_triggers": []
                    },
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "status": "CREATE_COMPLETE",
                    "status_reason": null,
                    "tags": [
                        {
                            "key": "Owner",
                            "value": "Coming"
                        },
                        {
                            "key": "Environment",
                            "value": "lab"
                        }
                    ]
                }
            ],
            "stack_description": {
                "capabilities": [
                    "CAPABILITY_NAMED_IAM"
                ],
                "change_set_id": "arn:aws:cloudformation:us-east-1:012345678901:changeSet/TestS-z901c3sm2i-r2vvp5d5yom/1a7a8671-0b43-43ab-ab23-1f55de0d7c9c",
                "creation_time": "2019-09-30T15:20:54.651000+00:00",
                "description": "Testing Ansible Changesets",
                "disable_rollback": false,
                "drift_information": {
                    "stack_drift_status": "NOT_CHECKED"
                },
                "enable_termination_protection": false,
                "last_updated_time": "2019-09-30T17:26:58.390000+00:00",
                "notification_arns": [],
                "outputs": [
                    {
                        "output_key": "Role2",
                        "output_value": "Test2"
                    },
                    {
                        "output_key": "Role1",
                        "output_value": "Test"
                    }
                ],
                "rollback_configuration": {
                    "rollback_triggers": []
                },
                "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                "stack_name": "TestStack",
                "stack_status": "UPDATE_COMPLETE",
                "tags": [
                    {
                        "key": "Owner",
                        "value": "Coming"
                    },
                    {
                        "key": "Environment",
                        "value": "lab"
                    }
                ]
            },
            "stack_events": [
                {
                    "client_request_token": "Console-ExecuteChangeSet-a4793dfc-4880-fb92-a604-6c4dbfc7d318",
                    "event_id": "83be2130-e3a7-11e9-b2e8-0eaa79b17470",
                    "logical_resource_id": "TestStack",
                    "physical_resource_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "resource_status": "UPDATE_COMPLETE",
                    "resource_type": "AWS::CloudFormation::Stack",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T17:27:02.071000+00:00"
                },
                {
                    "client_request_token": "Console-ExecuteChangeSet-a4793dfc-4880-fb92-a604-6c4dbfc7d318",
                    "event_id": "835ec320-e3a7-11e9-bf25-12c9298e4208",
                    "logical_resource_id": "TestStack",
                    "physical_resource_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "resource_status": "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS",
                    "resource_type": "AWS::CloudFormation::Stack",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T17:27:01.445000+00:00"
                },
                {
                    "client_request_token": "Console-ExecuteChangeSet-a4793dfc-4880-fb92-a604-6c4dbfc7d318",
                    "event_id": "818dd3b0-e3a7-11e9-a751-0eff07caa3c6",
                    "logical_resource_id": "TestStack",
                    "physical_resource_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "resource_status": "UPDATE_IN_PROGRESS",
                    "resource_status_reason": "User Initiated",
                    "resource_type": "AWS::CloudFormation::Stack",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T17:26:58.390000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "efe31620-e395-11e9-aa4c-1235152b041e",
                    "logical_resource_id": "TestStack",
                    "physical_resource_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "resource_status": "CREATE_COMPLETE",
                    "resource_type": "AWS::CloudFormation::Stack",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:21:12.570000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "IamRole2-CREATE_COMPLETE-2019-09-30T15:21:10.476Z",
                    "logical_resource_id": "IamRole2",
                    "physical_resource_id": "Test2",
                    "resource_properties": "{\"Path\":\"/\",\"RoleName\":\"Test2\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\",\"ssm:GetParameters\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                    "resource_status": "CREATE_COMPLETE",
                    "resource_type": "AWS::IAM::Role",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:21:10.476000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "IamRole1-CREATE_COMPLETE-2019-09-30T15:21:10.349Z",
                    "logical_resource_id": "IamRole1",
                    "physical_resource_id": "Test",
                    "resource_properties": "{\"Path\":\"/\",\"RoleName\":\"Test\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                    "resource_status": "CREATE_COMPLETE",
                    "resource_type": "AWS::IAM::Role",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:21:10.349000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "IamRole2-CREATE_IN_PROGRESS-2019-09-30T15:20:57.658Z",
                    "logical_resource_id": "IamRole2",
                    "physical_resource_id": "Test2",
                    "resource_properties": "{\"Path\":\"/\",\"RoleName\":\"Test2\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\",\"ssm:GetParameters\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                    "resource_status": "CREATE_IN_PROGRESS",
                    "resource_status_reason": "Resource creation Initiated",
                    "resource_type": "AWS::IAM::Role",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:20:57.658000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "IamRole1-CREATE_IN_PROGRESS-2019-09-30T15:20:57.640Z",
                    "logical_resource_id": "IamRole1",
                    "physical_resource_id": "Test",
                    "resource_properties": "{\"Path\":\"/\",\"RoleName\":\"Test\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                    "resource_status": "CREATE_IN_PROGRESS",
                    "resource_status_reason": "Resource creation Initiated",
                    "resource_type": "AWS::IAM::Role",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:20:57.640000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "IamRole1-CREATE_IN_PROGRESS-2019-09-30T15:20:57.176Z",
                    "logical_resource_id": "IamRole1",
                    "physical_resource_id": "",
                    "resource_properties": "{\"Path\":\"/\",\"RoleName\":\"Test\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                    "resource_status": "CREATE_IN_PROGRESS",
                    "resource_type": "AWS::IAM::Role",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:20:57.176000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "IamRole2-CREATE_IN_PROGRESS-2019-09-30T15:20:57.165Z",
                    "logical_resource_id": "IamRole2",
                    "physical_resource_id": "",
                    "resource_properties": "{\"Path\":\"/\",\"RoleName\":\"Test2\",\"Policies\":[{\"PolicyName\":\"parameter-store-permissions\",\"PolicyDocument\":{\"Statement\":[{\"Action\":[\"ssm:GetParametersByPath\",\"ssm:GetParameters\"],\"Resource\":\"*\",\"Effect\":\"Allow\"}]}}],\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"}}]}}",
                    "resource_status": "CREATE_IN_PROGRESS",
                    "resource_type": "AWS::IAM::Role",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:20:57.165000+00:00"
                },
                {
                    "client_request_token": "5bcfc3e3-ddf7-4768-8b7f-5fd89e917241",
                    "event_id": "e532ba50-e395-11e9-a250-0af228e676ce",
                    "logical_resource_id": "TestStack",
                    "physical_resource_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "resource_status": "CREATE_IN_PROGRESS",
                    "resource_status_reason": "User Initiated",
                    "resource_type": "AWS::CloudFormation::Stack",
                    "stack_id": "arn:aws:cloudformation:us-east-1:012345678901:stack/TestStack/e5321e10-e395-11e9-a250-0af228e676ce",
                    "stack_name": "TestStack",
                    "timestamp": "2019-09-30T15:20:54.651000+00:00"
                }
            ],
            "stack_outputs": {
                "Role1": "Test",
                "Role2": "Test2"
            },
            "stack_parameters": {},
            "stack_policy": {
                "Statement": [
                    {
                        "Action": "Update:*",
                        "Effect": "Allow",
                        "Principal": "*"
                    }
                ]
            },
            "stack_resource_list": [
                {
                    "drift_information": {
                        "stack_resource_drift_status": "NOT_CHECKED"
                    },
                    "last_updated_timestamp": "2019-09-30T15:21:10.349000+00:00",
                    "logical_resource_id": "IamRole1",
                    "physical_resource_id": "Test",
                    "resource_status": "CREATE_COMPLETE",
                    "resource_type": "AWS::IAM::Role"
                },
                {
                    "drift_information": {
                        "stack_resource_drift_status": "NOT_CHECKED"
                    },
                    "last_updated_timestamp": "2019-09-30T15:21:10.476000+00:00",
                    "logical_resource_id": "IamRole2",
                    "physical_resource_id": "Test2",
                    "resource_status": "CREATE_COMPLETE",
                    "resource_type": "AWS::IAM::Role"
                }
            ],
            "stack_resources": {
                "IamRole1": "Test",
                "IamRole2": "Test2"
            },
            "stack_tags": {
                "Environment": "lab",
                "Owner": "Coming"
            },
            "stack_template": "AWSTemplateFormatVersion: 2010-09-09\nDescription: Testing Ansible Changesets\nResources:\n  IamRole1:\n    Type: AWS::IAM::Role\n    Properties:\n      RoleName: Test\n      AssumeRolePolicyDocument:\n        Version: '2012-10-17'\n        Statement:\n          - Effect: Allow\n            Principal:\n              Service: lambda.amazonaws.com\n            Action: sts:AssumeRole\n      Path: /\n      Policies:\n      - PolicyName: parameter-store-permissions\n        PolicyDocument:\n          Statement:\n            - Action:\n                - ssm:GetParametersByPath\n              Effect: Allow\n              Resource: '*'\n  IamRole2:\n    Type: AWS::IAM::Role\n    Properties:\n      RoleName: Test2\n      AssumeRolePolicyDocument:\n        Version: '2012-10-17'\n        Statement:\n          - Effect: Allow\n            Principal:\n              Service: lambda.amazonaws.com\n            Action: sts:AssumeRole\n      Path: /\n      Policies:\n      - PolicyName: parameter-store-permissions\n        PolicyDocument:\n          Statement:\n            - Action:\n                - ssm:GetParametersByPath\n                - ssm:GetParameters\n              Effect: Allow\n              Resource: '*'\n\nOutputs:\n  Role1:\n    Value: !Ref IamRole1\n  Role2:\n    Value: !Ref IamRole2\n      \n"
        }
    }
}

@ansibot
Copy link
Contributor

ansibot commented Nov 7, 2019

@waffie1 this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 7, 2019

@waffie1, just so you are aware we have a dedicated Working Group for aws.
You can find other people interested in this in #ansible-aws on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 aws cloud feature This issue/PR relates to a feature request. merge_commit This PR contains at least one merge commit. Please resolve! module This issue/PR relates to a module. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Nov 7, 2019
@ansibot
Copy link
Contributor

ansibot commented Nov 7, 2019

cc @jmenga
click here for bot help

@ansibot ansibot added new_module This PR includes a new module. new_plugin This PR includes a new plugin. and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html new_module This PR includes a new module. labels Nov 7, 2019
@mattclay mattclay added the needs_ci_update This PR is blocked as it requires an update to CI infrastructure before tests can pass in CI. label Nov 7, 2019
@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Nov 7, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 15, 2019
@ansibot
Copy link
Contributor

ansibot commented Nov 22, 2019

@waffie1 this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot ansibot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html community_review In order to be merged, this PR must follow the community review workflow. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Nov 22, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 30, 2019
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Dec 9, 2019
@waffie1
Copy link
Contributor Author

waffie1 commented Dec 11, 2019

I've renamed the integration testsuite and the tests are failing due to the stack existing. I'm not sure if it didn't delete last time, or perhaps multiple tests are running in parallel. Do I need to randomize resource names to ensure this doesn't happen, or is something else going on?

@jillr jillr self-assigned this Dec 16, 2019
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Dec 16, 2019
Copy link
Contributor

@jillr jillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In CI multiple tests may run at the same time (aws/2.7 and aws/3.6, or just potentially multiple PRs testing at the same time), looks like you've got that sorted with resource_prefix now (and shippable as a resource prefix should work now in the CI policy).

Looking at the tests in this PR and #65643 I think it makes the most sense to land that one first then rebase these tests onto that. You'll need to rename main.yaml to main.yml before rebasing though, and use the stack from those tests. The python portion of this PR looks good to me, thanks very much for this cleanup and the new tests @waffie1.

Add ability to retrieve stack change sets
Update module to use AnsibleAWSModule
Update backoff to use new decorator style
Updated exceptions to use fail_json_aws
Converted outputs to snake_case where appropriate, for cloudformation_info only to preserve cloudformation_facts functionality.
  Unconverted keys are stack_outputs, stack_parameters, stack_policy,
  stack_resources, stack_tags and stack_template
aws-terminator permission for cloudformation have the following resource
Resource: arn:aws:cloudformation:us-east-1:{{ aws_account_id }}:stack/ansible-test*
updating test stack name to match
Add ability to retrieve stack change sets
Update module to use AnsibleAWSModule
Update backoff to use new decorator style
Updated exceptions to use fail_json_aws
Converted outputs to snake_case where appropriate, for cloudformation_info only to preserve cloudformation_facts functionality.
  Unconverted keys are stack_outputs, stack_parameters, stack_policy,
  stack_resources, stack_tags and stack_template
IAM policy in aws-terminator requires the stack name to begin with ansible-test
mistakenly updated when changing topic_name to use resource_prefix.  The test is to check the display name, which is what the stack update changes
remove uneeded files
using tests from #65643 with added check to validate changeset is present in info when requested
@waffie1
Copy link
Contributor Author

waffie1 commented Dec 18, 2019

Requested changes have been made. Using tests from #65643 with a cloudformation_info check inserted where those tests were already creating a change set.

Copy link
Contributor

@jillr jillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @waffie1!

@jillr jillr merged commit 45a413a into ansible:devel Dec 18, 2019
@waffie1 waffie1 deleted the cfinfo_add_change_sets branch December 19, 2019 20:54
@ansible ansible locked and limited conversation to collaborators Jan 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 aws cloud core_review In order to be merged, this PR must follow the core review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_ci_update This PR is blocked as it requires an update to CI infrastructure before tests can pass in CI. new_plugin This PR includes a new plugin. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants