Make this code callable as a module from other Terraform configurations #69
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.
In the spirit of #12 this PR provides the necessary changes to allow the configurations for each of the three providers to be called as a module from external Terraform configuration. This will allow developers to spin up clusters using this repo within the same Terraform state as other pieces of their overall infrastructure. It also makes it easier to use this repo for quickly spinning up and tearing down test clusters (which is my use case).
whoami.sh
script to be relative to the module.scripts/cloud/aws/ip-detect.aws.sh
unless the user provides another path by setting theip-detect
variable.test/fixtures/
to test the functionality provided by this PR. They are minimal Terraform configurations that call the configuration for a specific cloud provider and pass the minimum necessary variables to pass avalidate
andplan
. The variable values were taken fromdesired_cluster_profile.tfvars.example
within each provider configuration, so they match the existing smoke tests. Fixtures can be used to test calling the configuration as a module by runningterraform [validate|plan] -var-file=test.tfvars
within the fixture folder.ci_smoke_test.sh
to ensure future changes to the provider configurations don't break this functionality. One big thing it won't catch is new outputs with invalid names, but it's a start.If you're happy with the changes and they're merged, it's a good idea to start thinking about this repo as a set of modules with a specific interface. I'd recommend starting to tag releases so folks calling the module can pin to a specific release to avoid breaking changes.