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

stateful_provisioning resource for using provisioners as deployment steps #2696

Closed
wants to merge 1 commit into from
Closed

Conversation

apparentlymart
Copy link
Contributor

When using immutable architecture, deployment by creating, updating and deleting resources is sufficient. However, some applications are better suited to deployment via arbitrary provisioning that does not result in a managed resource, such as running chef on an existing host with particular arguments.

The stateful_provisioning resource provides an "escape hatch" to allow Terraform to be used for this sort of deployment. It allows the user to manually identify the intended state with an arbitrary string (the state key) and then Terraform simply re-runs a set of provisioners each time that string changes.

This is intended as a bridge into the "old world" of app deployment via provisioning scripts, so organizations can embrace Terraform as their primary deployment orchestrator without having to find an entirely separate solution for apps that don't fit well into the resource model.

The "state_key" artificially turns an imperative set of steps into a convergent configuration, allowing it to fit into Terraform's model as long as the user is able to adequately describe the desired state via interpolations into a string.

  • Provider
  • stateful_provisioning Resource
  • Documentation
  • Acceptance Tests (skipping these for this one since this resource doesn't actually really do anything, it's just exploiting existing behavior in helper/schema to get a useful side-effect.)

@apparentlymart
Copy link
Contributor Author

I'm hoping to use this mechanism to help us adopt Terraform for deployment across the board even though some of our apps are currently not ready to be deployed as immutable, throwaway instances.

Since I realize this is a rather unconventional resource I tried to write some detailed docs on it to help explain, but I lack the Ruby toolchain needed to render the site so I've not actually tested that I've got all the layouts and links right.

@phinze
Copy link
Contributor

phinze commented Jul 14, 2015

Wow this looks really interesting @apparentlymart!

Focusing on bugfixes at the moment to get a v0.6.1 release out the door, but will definitely circle back for a full review. 👍

@phinze phinze self-assigned this Jul 14, 2015
@catsby catsby added the core label Jul 15, 2015
@apparentlymart
Copy link
Contributor Author

I noticed that there's a Vagrantfile in the repo to get a middleman server running so I have now tested the docs and fixed one issue I found in the process. (needed to add a new selector to the _docs.scss file)

@apparentlymart
Copy link
Contributor Author

@phinze for this one I'm currently counting on having a feature like this available to move some of our applications onto Terraform, so if you have a moment it'd be good to have an opinion on whether this is a reasonable approach or whether I should make a new plan for deployment of these applications. Thanks!

@nicgrayson
Copy link

👍 This would be really helpful when doing bare metal provisioning where you can't just blow away the the server

When using immutable architecture, deployment by creating, updating and
deleting resources is sufficient. However, some applications are better
suited to deployment via arbitrary provisioning that does not result
in a managed resource, such as running chef on an existing host with
particular arguments.

The stateful_provisioning resource provides an "escape hatch" to allow
Terraform to be used for this sort of deployment, by allowing the user
to manually identify the intended state with an arbitrary string and
having Terraform simply re-run a set of provisioners each time that
string changes.
@phinze
Copy link
Contributor

phinze commented Oct 27, 2015

This is great work - we're moving in a similar but slightly-different direction. See #3244 for details.

@phinze phinze closed this Oct 27, 2015
@ghost
Copy link

ghost commented Apr 30, 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 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants