Skip to content

TECH-378: Remove old IAM resources #8

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

Merged
merged 3 commits into from
Mar 30, 2021

Conversation

magreenbaum
Copy link
Member

@magreenbaum magreenbaum commented Mar 29, 2021

Description

This is to remove old IAM resources that do not have the region name suffixes. Moved new resources in iam-new.tf into main.tf to consolidate.

See also changes to cloudwatch log group in comments. Using later aws provider versions has changed arn of cloudwatch logs.

Test

Applied in dev to confirm appropriate resources are destroyed and that the cloudwatch changes are accurate (note that this means bumping aws provider version to v3 in app repo using this module).

To Do

Once cutover to the new IAM instance profile is completed for all RMQ launch configurations, update source ref of rmq module in CMW to the hash of this commit. Also bump aws provider version to >3. This will be at least another 1.5 to 2 weeks out.

@magreenbaum magreenbaum requested a review from a team March 29, 2021 19:59
aws_cloudwatch_log_group.log_group.arn,
"${aws_cloudwatch_log_group.log_group.arn}/*"
"${aws_cloudwatch_log_group.log_group.arn}:*",
"${aws_cloudwatch_log_group.log_group.arn}:*:*"
Copy link
Member Author

@magreenbaum magreenbaum Mar 29, 2021

Choose a reason for hiding this comment

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

Bumping aws provider to latest revealed a bugfix that was done here which removed the :* from the cloudwatch logs arn: hashicorp/terraform-provider-aws#14214.
Now we'll need to specifically include the :*.

Also noting that the arn format of log group and log stream is:
Log group | arn:aws:logs:region:account-id:log-group:log_group_name
Log stream | arn:aws:logs:region:account-id:log-group:log_group_name:log-stream:log-stream-name
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html

Planning to bump CMW terraform aws provider to latest v3 which will have the arn bugfix. Required for these changes.

Tested in dev:

            "Resource": [
                "arn:aws:logs:<region>:<account>:log-group:rabbitmq-<app_name>-dev:*:*",
                "arn:aws:logs:<region>:<account>:log-group:rabbitmq-<app_name>-dev:*"

Logs show up in CW.

Copy link
Member

Choose a reason for hiding this comment

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

good catch!

Copy link
Member

@rraub rraub left a comment

Choose a reason for hiding this comment

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

Looks good!

@magreenbaum magreenbaum merged commit 82d0d1a into smartrent-master Mar 30, 2021
@magreenbaum magreenbaum deleted the tech-378-remove-old-iam-resources branch March 30, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants