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

OVERWRITE Mode does not warn about removing manual records #65

Open
amitai-devops opened this issue Jan 24, 2022 · 1 comment
Open

OVERWRITE Mode does not warn about removing manual records #65

amitai-devops opened this issue Jan 24, 2022 · 1 comment
Assignees

Comments

@amitai-devops
Copy link

amitai-devops commented Jan 24, 2022

Terraform Version

v1.0.4

Namecheap provider version

v2.0.2

Affected Resource(s)

Please list the resources as a list, for example:

  • namecheap_domain_records

Terraform Configuration Files

resource "namecheap_domain_records" "my-domain-com" {
  domain = "some.domain"
  mode = "OVERWRITE"
  email_type = "NONE"

  record {
    hostname = "hostname"
    type = "CNAME"
    address = "some.address"
  }

}

Debug Output

Terraform will perform the following actions:

  # namecheap_domain_records.my-domain-com will be created
  + resource "namecheap_domain_records" "my-domain-com" {
      + domain     = "some.domain"
      + email_type = "NONE"
      + id         = (known after apply)
      + mode       = "OVERWRITE"

      + record {
          + address  = "some.address"
          + hostname = "hostname"
          + mx_pref  = 10
          + ttl      = 1799
          + type     = "CNAME"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Expected Behavior

Should warn about removing existing resources that are created manually. Even thou the manual records are not in the TFState, if the API connection has already been made, and the OVERWRITE flag it true, some warning should be made.

Actual Behavior

Only says it is adding a resource, not deleting (outside of terraform, but still under the api call).

Steps to Reproduce

  1. terraform apply

Important Factoids

Because of this mistake, I accidentally deleted all production records and had to contact Namecheap support to restore them. It's unclear from the docs that the terraform will manage anything that was not created first by it, as intuitively this is terraform's use case. If mass-deletion was required, it would be better not to provide it using this provider as it can create confusion. If it's necessary, a warning should be made on the docs wherever Overwrite is written.

@StyleT
Copy link
Contributor

StyleT commented Jan 28, 2022

Hi!

Thanks to your feedback. Honestly speaking I'm not really sure that it's technically possible to show such a diff (which would clearly indicate removal of records) in Terraform.

Talking about the docs - fixed here cfd2a7d

@vetal2409 vetal2409 self-assigned this Feb 8, 2024
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

No branches or pull requests

3 participants