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 sns filter by name and time #482

Merged
merged 9 commits into from
Jun 28, 2023
Merged

add sns filter by name and time #482

merged 9 commits into from
Jun 28, 2023

Conversation

robpickerill
Copy link
Contributor

@robpickerill robpickerill commented Jun 26, 2023

Description

Fixes #359 and #480.

Adds the ability to include/exclude SNS topic by name for nuking. Additionally, the ability to exclude SNS topics by time is also added.

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.
  • Attention Grunts - if this PR adds support for a new resource, ensure the nuke_sandbox and nuke_phxdevops jobs in .circleci/config.yml have been updated with appropriate exclusions (either directly in the job or via the .circleci/nuke_config.yml file) to prevent nuking IAM roles, groups, resources, etc that are important for the test accounts.

Release Notes (draft)

Adds the ability to include/exclude SNS topic by name for nuking. Additionally, the ability to exclude SNS topics by time is also added.

Migration Guide

@robpickerill robpickerill changed the title add sns filter by name add sns filter by name and time Jun 27, 2023
@robpickerill
Copy link
Contributor Author

Note, I wanted to switch SNS over entirely to aws go SDK v2, as it uses both v1 and v2, but this PR is already quite large and I'll switch over to v2 in a separate PR

Copy link
Contributor

@james03160927 james03160927 left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Left a nit comment. I can trigger the test pipeline

aws/sns.go Outdated

for i := range response.Tags {
if *response.Tags[i].Key == key {
firstSeenTime, err := time.Parse(time.RFC3339, *response.Tags[i].Value)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we define a new constant in globals.go file the format of the time we will store the firstSeenTime, to prevent inconsistency in the future?

then, we can replace the usage of time.RFC3339 here and below in set function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I updated this in sns.go, and found occurrences in ec2_vpc.go and ecs_cluster.go. I can push these changes to a new PR if you'd like to keep the context to SNS in this PR. Either works for me.

@flichtenheld
Copy link
Contributor

FTR, I have tested the change in our environment and have verified that it fixes #480 for us. Thanks.

@james03160927
Copy link
Contributor

Tests looking good. Let's merge it in

Copy link
Contributor

@james03160927 james03160927 left a comment

Choose a reason for hiding this comment

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

LGTM

@james03160927 james03160927 merged commit 5587a21 into gruntwork-io:master Jun 28, 2023
@robpickerill robpickerill deleted the sns-filters branch June 28, 2023 21:18
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.

Exclusion support for SNS Topics?
3 participants