Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 04 16:09
    aaron-lane closed #464
  • Jan 04 16:05
    aaron-lane labeled #467
  • Jan 04 16:05
    aaron-lane labeled #467
  • Dec 30 2021 21:16
    tbugfinder commented #464
  • Dec 22 2021 21:55
    tbugfinder opened #467
  • Dec 09 2021 21:55
    nshenry03 closed #466
  • Dec 09 2021 21:55
    nshenry03 commented #466
  • Dec 09 2021 21:36
    aaron-lane labeled #466
  • Dec 09 2021 21:36
    aaron-lane labeled #466
  • Dec 09 2021 21:36
    aaron-lane commented #466
  • Dec 09 2021 21:29
    nshenry03 edited #466
  • Dec 09 2021 21:29
    nshenry03 opened #466
  • Oct 28 2021 15:15
    aaron-lane closed #411
  • Oct 28 2021 15:15
    aaron-lane commented #411
  • Oct 28 2021 14:47
    jnahelou commented #411
  • Oct 26 2021 15:50

    aaron-lane on master

    Fix test badges in README (compare)

  • Oct 11 2021 08:03
    rubans commented #464
  • Oct 07 2021 18:22
    tbugfinder closed #465
  • Oct 07 2021 18:22
    tbugfinder commented #465
  • Oct 07 2021 15:12
    aaron-lane labeled #465
tdsacilowski
@tdsacilowski

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
Aaron Lane
@aaron-lane
@tdsacilowski sorry for the delay! I replied a couple of days ago https://github.com/newcontext-oss/kitchen-terraform/issues/341#issuecomment-504443780
tdsacilowski
@tdsacilowski
Hi @aaron-lane thanks for the heads-up! I did see your reply and there are a few things I'm working on on my end and will update the ticket shortly.
Josef
@tbugfinder
Hi, while running kitchen verify I noticed that some output of inspec might get reduced (using ...), e.g. while testing many tags of an ec2 instance. Is there any setting to get always full output or is this more an inspec question?
Aaron Lane
@aaron-lane
@tbugfinder it's a both question. 😊 It may be a matter of changing the reporter which you can configure in the Kitchen configuration file
Brian G. Shacklett
@bgshacklett
My apologies if this has been discussed already, but does anyone know what effect, if any, Chef's new license policy has on using Kitchen-Terraform?
I.e., is it required to license Chef due to Inspec being used?
Aaron Lane
@aaron-lane
@bgshacklett I don't believe it has been discussed. As far as I am aware, the license only applies to the inspec-bin gem, whereas we use the plain inspec gem
Brian G. Shacklett
@bgshacklett
One thing that's interesting about that gem is that it has a runtime dependancy on https://rubygems.org/gems/license-acceptance. While I've never seen a request to accept a license when installing, that is a bit concerning.
Purple90
@Purple90
I just wanted to see if I am doing something wrong. I am running through the tutorial here - https://newcontext-oss.github.io/kitchen-terraform/getting_started.html and the tests are failing at the last step.
  Γ—  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
I do see foobar, but it is here
test/fixtures/tf_module/foobar
Jeff
@jeffcampbell
Anyone using kitchen-terraform with GCP? I am wondering if it always creates a new project when switching to a new workspace. Due to the nature of our terraform implementation we are strict with our resourcemanager.projectCreator roles. data.terraform_remote_state.organization: Refreshing state... google_project.project: Creating...
Aaron Lane
@aaron-lane
@Purple90 oh no, the tutorial may be out of date πŸ˜₯thanks for pointing that out
@jeffcampbell πŸ‘‹we spoke out of band, but for the benefit of the rest of the group, the use of workspaces means that all resources in the graph of the root_module_directory will be created specifically for the Kitchen Terraform instance
Edward Bartholomew
@edwardbartholomew
I have proposed writing an article for Azure docs regarding terraform testing with kitchen-terraform thumbs up appreciated: MicrosoftDocs/azure-docs#38222
Aaron Lane
@aaron-lane
Already done!
alepeltier
@alepeltier

Hello All,

Is there a way to mock remote states in kitchen or does the remote state file need to exist before hand ?

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" {
alepeltier
@alepeltier
Ah actually never mind I see that kitchen converge will create a test environment in AWS for me so I'll need the VPC and EKS states to be there beforehand.
On another point, any idea when terraform 12 will be supported?
Aaron Lane
@aaron-lane
@alepeltier Terraform 0.12 has been supported since Kitchen-Terraform 4.9.0 back on 2019-05-27 :D
Aaron Lane
@aaron-lane
Regarding remote state, Kitchen-Terraform was designed with the intent of testing individual modules, rather than environment configurations which leverage remote state. It's certainly possible to use remote state, but there are some changes needed to make this efficient. newcontext-oss/kitchen-terraform#348 comes to mind
alepeltier
@alepeltier

@aaron-lane Thank you for the reply sorry it's taken me so long to get back to you.

I'm glad tf 12 is supported I'll get that installed right away. I'll have a look at how we can use kitchen Terraform within our environment even if we have to do specific module testing for the time being it is better than nothing.

I'll also keep an eye on that git issue hopefully it is something that can be accommodated in future releases.
Aaron Lane
@aaron-lane
@alepeltier if you have any information you can share about your use case of testing configurations more complex than individual modules, please do so on a GitHub issue. I think it would be valuable for Kitchen-Terraform to be able to easily support more than one testing pattern
alepeltier
@alepeltier
@aaron-lane no worries I've had to put it on the back burner for a bit but once I pick it up I'll feed in our use case.
Edward Bartholomew
@edwardbartholomew
Was trying to update a tutorial or two but having a beast of a time trying to get middleman working even tried Docker images to no avail. Does middleman run as part of the build process or should the generated files be in the PR?
Aaron Lane
@aaron-lane
The generated files should be part of the pull request, but I'd really like to migrate to the format natively supported by GitHub Sites
Annie Hedgpeth
@anniehedgie_twitter
Hi, I see that I can use winrm as a backend, but I can't seem to get it to work with password authentication. Just wanted to confirm that password auth is enabled for winrm and not just ssl.
Annie Hedgpeth
@anniehedgie_twitter
I just found this comment about connections through InSpec - https://github.com/newcontext-oss/kitchen-terraform/issues/317#issuecomment-454264007. I'll troubleshoot that I can connect through InSpec.
Annie Hedgpeth
@anniehedgie_twitter
I can connect with an inspec exec so I guess I'll keep plugging trying different things in the kitchen.yml.
Annie Hedgpeth
@anniehedgie_twitter
Edward Bartholomew
@edwardbartholomew
Is anyone using Terraform variables in their Inspec tests as introduced in 4.8.0? Seems to only work through "variables" in kitchen.yml and not "variable_files" ... Not sure if that's expected from the wording of the CHANGELOG though (https://github.com/newcontext-oss/kitchen-terraform/blob/master/CHANGELOG.md#480---2019-04-14)
Aaron Lane
@aaron-lane
That is expected! I've been wary of doing any state inspection to derive values so it only works for the variables defined in the Kitchen configuration file
I think I should just parse the state and make things much easier
Edward Bartholomew
@edwardbartholomew
Thank you for confirmation of being expected. I just wanted to make sure it was me and not the code :) I had started to dig into the source code but got distracted and never returned to it. I think it's fine as-is, but if output is from statefile too, then might be more consistent approach?
Edward Bartholomew
@edwardbartholomew
#378 my documentation PR still stuck on a failing test, not quite sure how to troubleshoot.
Aaron Lane
@aaron-lane
The outputs are from the output command. I have not checked lately if there is a command to display the variable values in a parsable format
Edward Bartholomew
@edwardbartholomew
I don't see any tf command after checking the docs!
Aaron Lane
@aaron-lane
@edwardbartholomew I'm at a resort with very poor WiFi. I'll have to check your tutorial in the new year 😬
@anniehedgie_twitter I'll also try to get some solutions for your issues in the new year as well
Edward Bartholomew
@edwardbartholomew
@aaron-lane Thanks for the update, enjoy your resort, and happy new year!!!
Aaron Lane
@aaron-lane
πŸŽ‡πŸŽ†
Saul Jaramillo
@describeme
hey guys, does any body know if there is any way to skip terraform apply for workspaces other than the default while running test-kitchen (converge, verify) commands
i want to apply the default workspace and then just run tests on it not create an additional workspace that duplicates the infrastructure and run tests on it
Aaron Lane
@aaron-lane
Hey @describeme! #348 tracks a request for that behaviour. Please add any additional information you think could be useful
Aaron Lane
@aaron-lane
Aaron Lane
@aaron-lane
v5.30 has been released!