aaron-lane on v6.1.0
aaron-lane on master
6.1.0 (#468) * Add support for… (compare)
aaron-lane on aaron-lane-6.1.0
aaron-lane on aaron-lane-6.1.0
Remove obsolete Travis CI refer… Update tty-which to ~> 0.5.0 Update bundle binstub and 2 more (compare)
aaron-lane on master
Create codeql-analysis.yml (compare)
terraform
:scream_cat:
Hi all! I have a question regarding backend-configurations
, specifically interacting with Terraform's remote backend. I've posted my question as a follow-on to this thread: newcontext-oss/kitchen-terraform#341. A colleague of mine also mentioned you all have a gitter room so I figured I'd post here as well. Thanks!
Hi there, I have an additional question on this topic... and forgive me if I misunderstand how some of this configuration works, still wrapping my head around kitchen-terraform.
Makes sense that you'd define the backend type in your Terraform configuration file and just pass specific parameters for it through your kitchen.yml
file. One area where I see an issue though is with the remote
backend type.
This type takes a number of configuration parameters, one of them being workspaces
, which is configured as a block. The documentation for Class: Kitchen::Driver::Terraform
indicates that backend_configurations
is of the type "Mapping of scalars to scalars
", which seems to indicate that I can't have a nested block here.
This would be especially useful for setting a prefix
to be added to the workspaces that kitchen-terraform creates via the CLI, since the remote backend also supports a CLI-driven workflow for interfacing with Terraform Cloud and Terraform Enterprise.
Curious if this is supported and if maybe I'm just missing something?
For reference, I tried the following in my kitchen.yml
file:
---
driver:
name: terraform
backend_configurations:
organization: teddyruxpin
hostname: app.terraform.io
workspaces:
prefix: kt-validate
...
And received the following error response:
Dev/ptfe-testing/terraform-gcp via 🛠 default took 3s
❯ bundle exec kitchen verify
-----> Starting Kitchen (v1.25.0)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: Kitchen::Driver::Terraform configuration: backend_configurations {:value=>["must be a hash which includes only symbol keys and string values"]}
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
× file_check: File .kitchen/kitchen-terraform/kt-suite-terraform/foobar
× File .kitchen/kitchen-terraform/kt-suite-terraform/foobar should exist
expected File .kitchen/kitchen-terraform/kt-suite-terraform/foobar to exist
test/fixtures/tf_module/foobar
resourcemanager.projectCreator
roles. data.terraform_remote_state.organization: Refreshing state...
google_project.project: Creating...
root_module_directory
will be created specifically for the Kitchen Terraform instance
For example, I've got a brand new environment which I'm trying to test my code against. I haven't run an apply in this environment yet and I get the following Terraform error when running "kitchen test"
Error: Unable to find remote state
on data.tf line 4, in data "terraform_remote_state" "eks":
4: data "terraform_remote_state" "eks" {
No stored state was found for the given workspace in the given backend.
Error: Unable to find remote state
on data.tf line 25, in data "terraform_remote_state" "vpc":
25: data "terraform_remote_state" "vpc" {