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 allowed_deletion Config Option to resourceHerokuApp #391

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yknx4
Copy link

@yknx4 yknx4 commented Jan 13, 2025

Add allowed_deletion Config Option to resourceHerokuApp

Description

This PR introduces a new configuration option, allowed_deletion, to the resourceHerokuApp resource in the terraform-provider-heroku. By default, this option blocks any actions that require deletion of a Heroku app, unless explicitly allowed by the user. This change is not backward-compatible, as all delete operations will now be blocked by default unless allowed_deletion is explicitly set to true.

Changes

  1. allowed_deletion Option:

    • Type: bool
    • Default: false
    • Description: When set to false (default), any action requiring the deletion of a Heroku app (e.g., terraform destroy or terraform apply with a delete operation) will fail with a clear error message.
    • When explicitly set to true, deletion actions are allowed, restoring the previous behavior.
  2. Behavior Changes:

    • Default behavior has changed. If allowed_deletion is not explicitly set, deletion actions will now fail.
    • Users must explicitly set allowed_deletion = true to permit deletions.
  3. Documentation Updates:

    • The resource_heroku_app documentation has been updated to detail the allowed_deletion option, its purpose, and provide examples for enabling deletion.
  4. Tests:

    • Unit tests added to verify the behavior of allowed_deletion in scenarios with and without deletion actions.

Why is this change necessary?

Accidental deletion of Heroku apps can lead to data loss and service outages. This change introduces a safer default configuration that requires explicit user action to allow deletions, reducing the risk of unintended consequences.

Example Usage

resource "heroku_app" "example" {
  name             = "example-app"
  region           = "us"
  allowed_deletion = true # Enables deletions
}

@yknx4 yknx4 changed the title Prevent app deletion by default Add allowed_deletion Config Option to resourceHerokuApp Jan 13, 2025
@yknx4 yknx4 changed the title Add allowed_deletion Config Option to resourceHerokuApp Add allowed_deletion Config Option to resourceHerokuApp Jan 13, 2025
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.

1 participant