Create flag for specifying backend config #232
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.
Updates
--backend-config
flag forghpc create
andghpc expand
.For this PR, I checked the following test cases.
CLI Usage
Case 1: No backend config by Yaml and CLI
This checks that backend config is not created if it's not specified by Yaml or CLI.
Just run the following command with the default
examples/hpc-cluster-small.yaml
:Success if Terraform Backend statement is not present in
hpc-cluster-small/primary/main.tf
.Case 2: Backend config by Yaml file
Add the following section in
examples/hpc-cluster-small.yaml
.Run the following command:
Success if Terraform Backend statement is present in
hpc-cluster-small/primary/main.tf
like below.Case 3: Backend config by CLI
No backend section in Yaml file which is the default
examples/hpc-cluster-small.yaml
, run the following command:With "type=gcs":
Without "type=gcs":
The tool sets "gcs" as backend type by default.
Success if Terraform Backend statement is present in
hpc-cluster-small/primary/main.tf
like below.Case 4: Backend config by Yaml file & CLI
The toolkit overrides the backend config in the yaml file by variables at CLI.
Add the following section in
examples/hpc-cluster-small.yaml
.Run the following command:
Success if Terraform Backend statement is present in
hpc-cluster-small/primary/main.tf
and it has the variables set by CLI (e.g.a_bucket_cli
, nota_bucket
) like below.Expand command
Tested
./ghpc expand
similar to./ghpc create
with the test cases above.If no Terraform backend config is specified,
terraform_backend_defaults
doesn't have any values inexpanded.yaml
like below:If Terraform backend config is specified by Yaml or CLI,
terraform_backend_defaults
looks like below:If Terraform backend config is specified by Yaml and CLI,
terraform_backend_defaults
has the values set by CLI:Appendix
Run with parameters at minimum:
Submission Checklist
pre-commit install
make tests
change?
guides?