-
Notifications
You must be signed in to change notification settings - Fork 0
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
initial terraform support #2
Conversation
cmd/deploy-terraform/terraform.go
Outdated
} | ||
for _, config := range backendConfigs { | ||
args = append(args, fmt.Sprintf("-backend-config=%s", strconv.Quote(config))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this part?
Were you able to use those Terraform flags on the CLI and it just doesn't work from Go? Or did those flags also fail to work on the CLI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right. Initially I thought this would work, but it did not and I found an issue that said this. So I believe it is not actually supported. But I have not cross checked to see whether I could do this directly from the cli. I will check into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is what I see on the command line:
$KUBE_NAMESPACE=test-terraform TF_PLUGIN_CACHE=/tmp/foo TF_VAR_hello=foo terraform init -input=false -backend-config="type=kubernetes" -backend-config="secret_suffix=dev" -no-color
Initializing the backend...
Initializing provider plugins...
- Reusing previous version of hashicorp/tfcoremock from the dependency lock file
- Using previously-installed hashicorp/tfcoremock v0.2.0
Warning: Missing backend configuration
-backend-config was used without a "backend" block in the
configuration.
If you intended to override the default local backend configuration,
no action is required, but you may add an explicit backend block to
your
configuration to clear this warning:
terraform {
backend "local" {}
}
However, if you intended to override a defined backend, please verify
that
the backend configuration is present and valid.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
I will for now remove using the -backend-config
related approach and instead stick with the template approach.
Fixes #1
Please read
docs/deploy.adoc
.This is an experimental version meant to get started and enable concrete feedback on some of the choices made, such as:
.ods/cache/deps/terraform
to support caching of provider versions.In addition future work which would likely make sense is: