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

deleting resources via Atlantis #563

Closed
justinhauer opened this issue Apr 2, 2019 · 12 comments
Closed

deleting resources via Atlantis #563

justinhauer opened this issue Apr 2, 2019 · 12 comments
Labels
question Further information is requested

Comments

@justinhauer
Copy link

justinhauer commented Apr 2, 2019

How are people using Atlantis to remove resources? say I deploy resources via Atlantis into my cloud provider, and I now want to manage the full life cycle of that resource. Do I run an Atlantis destroy (Terraform destroy) through a PR to specify that specific item as well? I need to have a better understanding of how people are handling that.

@justinhauer
Copy link
Author

I realized that I can do this via atlantis plan -- -destroy from finding a closed issue. Can this be please be added to the documentation (If it is, more clearly?)?

@justinhauer
Copy link
Author

Also, is there a way for atlantis to destroy a specific resource within a .tf file? Like:

terraform destroy -target RESOURCE_TYPE.NAME -target RESOURCE_TYPE2.NAME

@lkysow
Copy link
Member

lkysow commented Apr 2, 2019

If the resource is in Terraform, then delete it from your config file and push a PR and the plan will contain the deletion of that resource.

atlantis plan -- -destroy is used if you want to delete all the resources in a certain config.

There is no way to run the destroy command you show above (that I know of) other than to delete it from your code.

@lkysow lkysow added the question Further information is requested label Apr 2, 2019
@justinhauer
Copy link
Author

Thanks for your reply on this. Realizing that this was an issue with me not configuring a remote state file previously

@lkysow
Copy link
Member

lkysow commented Apr 2, 2019

Ahh, yeah sorry about that. I need to implement #435

@lkysow
Copy link
Member

lkysow commented Apr 2, 2019

I'll close this then unless you have more questions.

@lkysow lkysow closed this as completed Apr 2, 2019
@justinhauer
Copy link
Author

just add documentation please that people need to configure a remote state

@lkysow
Copy link
Member

lkysow commented Apr 2, 2019

This is already documented: https://www.runatlantis.io/docs/requirements.html#terraform-state

But a warning in the actual comments would be more effective.

@kzap
Copy link

kzap commented Nov 7, 2019

Sorry old comment but what about commenting out your TF resources and submitting that as a PR, or renaming the .tf files as something else if you separate your resources from the provider and state config?

@jamengual
Copy link
Contributor

jamengual commented Mar 19, 2021

that is the same thing as deleting the resource from the file and pushing forward.

I personally prefer :

resource "aws_sns_topic" "default" {
  count             = var.enabled ? 1 : 0
  name              = join(module.this.delimiter, [local.alert_for, "threshold", "alerts"])
  tags              = module.this.tags
  kms_master_key_id = var.kms_master_key_id
}

some people argue that count is overused and I think it is an absolutely baseless argument since is like saying using while loops are a hack, the reason people say that is because in the TF 0.11 days it was the only way to do loops and conditions and some of them were long and ugly but now you have for, for_each and count.

@rjayaprakash-exelixis
Copy link

can we run the target flag in Atlantis to destroy specific resources?

atlantis plan -- -destroy -target RESOURCE_TYPE.NAME -target RESOURCE_TYPE2.NAME

@nitrocode
Copy link
Member

nitrocode commented Jun 8, 2023

Yes that's possible. Please see #3288.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants