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 ability to preserve local_file on destroy #17040

Closed
alanbchristie opened this issue Jan 5, 2018 · 2 comments
Closed

Add ability to preserve local_file on destroy #17040

alanbchristie opened this issue Jan 5, 2018 · 2 comments

Comments

@alanbchristie
Copy link

Would it be possible to add a do_not_destroy argument to the local_file configuration item so that when terraform destroy is executed the generated local file is left intact? The reason? I create dynamic content for a post-destroy Ansible script and it would be useful to keep the content of the locally-generated file for this playbook.

i.e. would it be acceptable to provide the ability to do this...

resource "local_file" "cleanup_vars" {
  content = "${data.template_file.cleanup_vars.rendered}"
  filename = "../../../ansible/aws-cleanup/vars.yml"
  do_not_destroy = true
}

With the above if terraform apply is re-excuted is is perfectly fine (and expected) to over-write any existing file.

Terraform Version

Terraform v0.11.1

Terraform Configuration Files

data "template_file" "cleanup_vars" {
  template = "${file("../../../ansible/aws-cleanup/vars.yml.tpl")}"

  vars {
    aws_region = "${var.aws_region}"
  }
}

resource "local_file" "cleanup_vars" {
  content = "${data.template_file.cleanup_vars.rendered}"
  filename = "../../../ansible/aws-cleanup/vars.yml"
}

Debug Output

n/a

Crash Output

n/a

Expected Behavior

n/a

Actual Behavior

n/a

Steps to Reproduce

n/a

Additional Context

n/a

References

n/a

@hashibot
Copy link
Contributor

hashibot commented Jan 5, 2018

This issue has been automatically migrated to hashicorp/terraform-provider-local#7 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@hashibot hashibot closed this as completed Jan 5, 2018
@ghost
Copy link

ghost commented Apr 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants