support non-cloud providers and backends #174
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a π bug fix.
This is a πββοΈ feature or enhancement.
This is a π§ documentation change.
bundle exec rspec
to verify this)Summary
Support for non-cloud providers and backends by decoupling the backend detection from terraspace plugins. The backend detection is simpler and will not run ERB on the detection pass. With the normal compile pass, it will run ERB.
Context
Seems like folks are using the gitlab backend.
This allows folks to use the http backend or any other backend https://www.terraform.io/language/settings/backends/local
How to Test
Use a backend example like what @yisyang provided in #160 (comment) and @Grummfy boltops-tools/terraspace-docs#16 Example:
config/terraform/backend.tf:
You can set the env var defaults with the config/boot.rb hook.
config/boot.rb:
Note: Using
:ENV-:TYPE_DIR-:MOD_NAME
which includes env, stacks/modules as a prefix in the state path name to generalize. If you're sure that you're not going to be deployingapp/modules
directly, you can use the simpler:ENV-:MOD_NAME
. Though like the shorter path, showing the generalized one just in case and to avoid possible people in the future venting π€£ It does not include region because the http backend results in a generic expander being used. Once this is released and docs are merged in also, there is an example of how you add the region in the docs. You can also see this PR: boltops-tools/terraspace-docs#21 right now.Example of state files on GitLab:
For backend variables, see: https://terraspace.cloud/docs/config/backend/variables/
Also, notice instead of the use of
-
instead of/
. This is because the GitLab http backend urls are resource urls. Using/
will mean a different url resource. So we have to use-
. IE::ENV-:TYPE_DIR-:MOD_NAME
vs:ENV/:TYPE_DIR/:MOD_NAME
Local Backend
Also, tested with local backend. Here's an example:
config/terraform/backend.tf
The local statefile is stored at:
Docs for this will also be in this docs PR boltops-tools/terraspace-docs#21
Version Changes
Minor