binbashar / terraform-aws-ec2-basic-layout

Terraform module to deploy a typical EC2 layout that includes an instance with a security group and a dns record.
Apache License 2.0
5 stars 3 forks source link

Fix: enabling SSM access when a profile is passed #36

Closed joseapeinado closed 1 year ago

joseapeinado commented 1 year ago

what

It fixes the bug #35 while enabling SSM access and passing an instance_profile value.

why

When the instance_profile was provided and enable_ssm_access was set to true, the resource aws_iam_role_policy_attachment.ec2_ssm_access tried to attach the managed policy AmazonSSMManagedInstanceCore to a non existing role basic_instance_assume_role, which is only created when the instance_profile is empty.

references

exequielrafaela commented 1 year ago

@joseapeinado The tests passed after the fix => https://app.circleci.com/pipelines/github/binbashar/terraform-aws-ec2-basic-layout/228/workflows/24e86786-6b3b-404a-a498-6069cbf15539/jobs/328 But I don't get why they're failing now. For this iteration I'll move forward and merge this PR and we can give it another try the next PR.