Skip to content

feat: Adding cloud-nuke cron #4306

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 4 commits into from
May 20, 2025
Merged

feat: Adding cloud-nuke cron #4306

merged 4 commits into from
May 20, 2025

Conversation

yhakbar
Copy link
Collaborator

@yhakbar yhakbar commented May 20, 2025

Description

Adds daily cloud-nuke cron.

Can't really test this yet. Gonna rely on review to help me determine if this is configured right, then merge it to test off main.

TODOs

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.

Release Notes (draft)

Added cloud-nuke cron.

Migration Guide

Summary by CodeRabbit

  • New Features

    • Introduced a daily automated workflow to scan and report on aged S3 resources in AWS using the cloud-nuke tool. The workflow runs nightly and can also be triggered manually.
    • Added a configuration file to customize the timeout and filtering of S3 buckets during the scan.
  • Chores

    • Set up GitHub Actions to automate cloud resource cleanup checks with a dry-run mode for initial testing.

Copy link

vercel bot commented May 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
terragrunt-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2025 2:28pm

Copy link
Contributor

coderabbitai bot commented May 20, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

A new GitHub Actions workflow has been introduced to automate the execution of the cloud-nuke tool on AWS resources. This workflow is scheduled to run daily and uses a newly added configuration file that specifies S3 timeout settings and bucket name filters. The workflow currently operates in dry-run mode for testing.

Changes

File(s) Change Summary
.github/cloud-nuke/config.yml Added a configuration file for cloud-nuke with an S3 timeout of 10 minutes and a bucket name filter regex.
.github/workflows/cloud-nuke.yml Introduced a scheduled GitHub Actions workflow to install, configure, and run cloud-nuke on AWS in dry-run mode.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant AWS
    participant cloud-nuke

    GitHub Actions->>GitHub Actions: Checkout repository
    GitHub Actions->>GitHub Actions: Download & install cloud-nuke binary
    GitHub Actions->>AWS: Assume AWS role using secrets
    GitHub Actions->>cloud-nuke: Execute cloud-nuke (dry-run, debug, S3, config file)
    cloud-nuke->>AWS: Interact with AWS S3 resources (dry-run)
    cloud-nuke-->>GitHub Actions: Output results
Loading

Possibly related PRs

  • feat: Adding cloud-nuke cron #4306: Adds the same .github/cloud-nuke/config.yml and .github/workflows/cloud-nuke.yml files to automate cloud-nuke runs, indicating a direct relation.

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed9f2e1 and 66632b7.

📒 Files selected for processing (1)
  • .github/workflows/cloud-nuke.yml (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yhakbar yhakbar marked this pull request as ready for review May 20, 2025 13:25
@yhakbar yhakbar requested a review from denis256 as a code owner May 20, 2025 13:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/cloud-nuke.yml (2)

19-30: Consider caching or a dedicated download action
Currently you’re downloading the binary on each run via wget. You could leverage actions/cache to avoid repeated downloads, or use a community action like actions/download-release@v1 for clearer intent and built-in version resolution.


12-14: Prevent overlapping runs with concurrency
To avoid collisions if one run exceeds 24 hours, consider adding a concurrency block at the job level:

jobs:
  run_cloud_nuke:
    concurrency:
      group: daily-cloud-nuke
      cancel-in-progress: false
    runs-on: ubuntu-latest
    ...
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7849d8b and 80a296f.

📒 Files selected for processing (2)
  • .github/cloud-nuke/config.yml (1 hunks)
  • .github/workflows/cloud-nuke.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (18)
  • GitHub Check: Test (Parse)
  • GitHub Check: Test (Deprecated)
  • GitHub Check: Test (Provider Cache Terraform 1.11)
  • GitHub Check: Test (Race)
  • GitHub Check: Test (AWS Terraform 1.11)
  • GitHub Check: Test (AWS Tofu)
  • GitHub Check: Test (AWS Terraform 1.5)
  • GitHub Check: Test (Fixtures Terraform 1.11)
  • GitHub Check: Build (linux/amd64)
  • GitHub Check: Test (Fixtures Terraform 1.5)
  • GitHub Check: Build (darwin/arm64)
  • GitHub Check: Build (linux/386)
  • GitHub Check: Test (Fixtures OpenTofu 1.9)
  • GitHub Check: Build (linux/arm64)
  • GitHub Check: Build (windows/amd64)
  • GitHub Check: Test (macos)
  • GitHub Check: Test (ubuntu)
  • GitHub Check: Pull Request has non-contributor approval
🔇 Additional comments (4)
.github/cloud-nuke/config.yml (1)

1-2: Validate s3.timeout format and approve syntax
The YAML structure is correct and there are no syntax errors. Please confirm that the 10m duration string is supported by cloud-nuke’s config parser (some versions require Go-duration formats or explicit units).

.github/workflows/cloud-nuke.yml (3)

2-5: Confirm daily schedule timing
cron: "0 0 * * *" triggers at midnight UTC every day. Verify that this matches your intended maintenance window.


8-11: Permissions scope is appropriate
Using id-token: write for OIDC-based AWS role assumption and contents: read for checkout adheres to least-privilege principles.


37-45: Verify --older-than unit support
Some cloud-nuke versions expect durations like 24h rather than 1d. Please check that 1d is accepted in your target version (0.40.0).

denis256
denis256 previously approved these changes May 20, 2025
@yhakbar yhakbar merged commit a501718 into main May 20, 2025
33 of 38 checks passed
@yhakbar yhakbar deleted the feat/adding-cloud-nuke-cron branch May 20, 2025 14:27
@coderabbitai coderabbitai bot mentioned this pull request May 20, 2025
4 tasks
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