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

Resources should support a 'delete' action #362

Closed
ljfranklin opened this issue Apr 9, 2016 · 9 comments
Closed

Resources should support a 'delete' action #362

ljfranklin opened this issue Apr 9, 2016 · 9 comments

Comments

@ljfranklin
Copy link
Contributor

Use Case

I'm working on a terraform resource which includes an option to run terraform destroy via a 'put':

- put: terraform
  params:
    action: destroy

This action destroys the infrastructure, removes the state file from S3, and returns the current timestamp as the version. Prior to the destroy step the version is the last modified time of the state file.

Issue

The put action is followed by an implicit get. In the normal case, a get would return an error if that state file could not be found. However, the implicit get should no-op after a put destroys the state file. My current workaround is to use get_params to tell get to no-op:

- put: terraform
  params:
    action: destroy
  get_params:
    action: destroy

This works, but requiring the user to specify a duplicate get_params action is confusing / error-prone. I think this problem would also apply to other resources that could destroy things like the CloudFormation and bosh-deployment resources.

Updated Suggestion from @vito and @robdimsdale

Supporting a delete resource option in addition to get and put clearly describes the intent of the action and avoids hacky patterns around destructive put operations.

Original Suggestion

One possible fix could be allowing resource authors to disable the implicit get following a destructive put via a new out field:

{
  "version": { "last_modified": "2016-04-09T19:20:47Z" },
  "metadata": [],
  "disable_implicit_get": true
}

Thanks!

@concourse-bot
Copy link
Collaborator

Hi there!

We use Pivotal Tracker to provide visibility into what our team is working on. A story for this issue has been automatically created.

The current status is as follows:

  • #118060317 Resources should support a 'delete' action

This comment, as well as the labels on the issue, will be automatically updated as the status in Tracker changes.

@robdimsdale
Copy link
Contributor

There are multiple resource that need to solve this problem. I think the right way to solve this it is for concourse to support delete as a resource operation, similar to get and put.

That would map more obviously to the underlying operation, rather than relying on esoteric params in the put that likely would differ between resources.

ljfranklin added a commit to ljfranklin/terraform-resource that referenced this issue Apr 9, 2016
@vito
Copy link
Member

vito commented Apr 10, 2016

👍 to @robdimsdale - this feels more appropriate with a delete action. I don't like the idea of resources saying to not perform a get after a put. If you've produced something (the intent of put) you should be able to fetch it. Sometimes that means doing a no-op.

@robdimsdale
Copy link
Contributor

@vito is a delete on the radar? Any stories to keep an eye on?

@vito
Copy link
Member

vito commented Apr 10, 2016

@ljfranklin
Copy link
Contributor Author

👍 to you both. A first-class delete option would be ideal, I re-worded the issue to reflect this.

@ljfranklin ljfranklin changed the title Allow a resource author to disable the implicit 'get' following a destructive 'put' Resources should support a 'delete' option Apr 10, 2016
@vito vito changed the title Resources should support a 'delete' option Resources should support a 'delete' action Jul 13, 2016
@vito
Copy link
Member

vito commented Jul 14, 2016

Consolidating into #362

@vito vito closed this as completed Jul 14, 2016
@oppegard
Copy link
Contributor

@vito Now that this issue is closed, where is the feature being tracked so I can follow along?

@vito
Copy link
Member

vito commented Jul 14, 2016

#534 - messed up my link

On Thu, Jul 14, 2016, 12:28 PM Glenn Oppegard notifications@github.com
wrote:

@vito https://github.com/vito Now that this issue is closed, where is
the feature being tracked so I can follow along?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#362 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAAHWF77_39K5bmuliImp1wCukmiz9hRks5qVo3wgaJpZM4IDtiH
.

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

5 participants