From adfaefb7321616da2975c95c87a4973d77aea5c4 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 4 Sep 2019 21:33:01 +0200 Subject: [PATCH] ec2_launch_template: Fix integration tests (#61260) * ec2_launch_template: (integration tests) make sure security_token is optional * ec2_launch_template: (integration tests) add dependencies at the top level so they're pulled into the docker containers * Update Hacking Compute Policies for Launch Templates --- hacking/aws_config/testing_policies/compute-policy.json | 3 +++ test/integration/targets/ec2_launch_template/meta/main.yml | 3 +++ .../playbooks/roles/ec2_launch_template/tasks/main.yml | 2 +- .../targets/ec2_launch_template/playbooks/version_fail.yml | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 test/integration/targets/ec2_launch_template/meta/main.yml diff --git a/hacking/aws_config/testing_policies/compute-policy.json b/hacking/aws_config/testing_policies/compute-policy.json index cd96dd24ffe..ecf5b158ce3 100644 --- a/hacking/aws_config/testing_policies/compute-policy.json +++ b/hacking/aws_config/testing_policies/compute-policy.json @@ -33,6 +33,9 @@ "Sid": "AllowUnspecifiedEC2Resource", "Effect": "Allow", "Action": [ + "ec2:*LaunchTemplate", + "ec2:*LaunchTemplateVersion", + "ec2:*LaunchTemplateVersions", "ec2:AllocateAddress", "ec2:AssociateAddress", "ec2:AssociateDhcpOptions", diff --git a/test/integration/targets/ec2_launch_template/meta/main.yml b/test/integration/targets/ec2_launch_template/meta/main.yml new file mode 100644 index 00000000000..1f64f1169a9 --- /dev/null +++ b/test/integration/targets/ec2_launch_template/meta/main.yml @@ -0,0 +1,3 @@ +dependencies: + - prepare_tests + - setup_ec2 diff --git a/test/integration/targets/ec2_launch_template/playbooks/roles/ec2_launch_template/tasks/main.yml b/test/integration/targets/ec2_launch_template/playbooks/roles/ec2_launch_template/tasks/main.yml index 09ca075f218..a36898f1d82 100644 --- a/test/integration/targets/ec2_launch_template/playbooks/roles/ec2_launch_template/tasks/main.yml +++ b/test/integration/targets/ec2_launch_template/playbooks/roles/ec2_launch_template/tasks/main.yml @@ -12,7 +12,7 @@ group/aws: aws_access_key: "{{ aws_access_key }}" aws_secret_key: "{{ aws_secret_key }}" - security_token: "{{ security_token }}" + security_token: "{{ security_token | default(omit) }}" region: "{{ aws_region }}" block: - include_tasks: cpu_options.yml diff --git a/test/integration/targets/ec2_launch_template/playbooks/version_fail.yml b/test/integration/targets/ec2_launch_template/playbooks/version_fail.yml index 0db80028e05..02b87f4a299 100644 --- a/test/integration/targets/ec2_launch_template/playbooks/version_fail.yml +++ b/test/integration/targets/ec2_launch_template/playbooks/version_fail.yml @@ -7,7 +7,7 @@ group/aws: aws_access_key: "{{ aws_access_key }}" aws_secret_key: "{{ aws_secret_key }}" - security_token: "{{ security_token }}" + security_token: "{{ security_token | default(omit) }}" region: "{{ aws_region }}" tasks: - block: @@ -23,7 +23,7 @@ register: ec2_lt ignore_errors: yes - - name: check that graceful error message is returned when creation with cpu_options and old botocore + - name: check that graceful error message is returned when creation with cpu_options and old botocore assert: that: - ec2_lt is failed