Skip to content
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

Can't authenticate via Kitchen, fine via InSpec #221

Closed
williamayerst opened this issue Nov 18, 2019 · 2 comments
Closed

Can't authenticate via Kitchen, fine via InSpec #221

williamayerst opened this issue Nov 18, 2019 · 2 comments

Comments

@williamayerst
Copy link

williamayerst commented Nov 18, 2019

Describe the problem

I have set up a ~/.azure/credentials file as directed, and written a simple test to see if an RG exists. I run inspec exec azure -t azure://, the my tests pass or fail successfully as appropriate.

However, if I run this within the context of a kitchen test run, my provisioning (via Terraform) succeeds, but when InSpec is run as verifier, I get errors. It seems to be related to the fact I can't supply a target to InSpec when it's called from .kitchen.yml in the way that I can from the command line (see above).

My inspec.yml looks like the below:

driver:
  name: terraform

provisioner:
  name: terraform

verifier:
  name: inspec
  # host: <subscription ID> 
  # host: azure://<subscription ID> 
  # host: azure://
  # backend: azure

platforms:
  - name: azure

suites:
  - name: default
    verifier:
        name: "inspec"
        patterns:
        - "azure/controls/test_rg.rb"

The error is:

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [Client error, can't connect to 'ssh' backend: You must provide a value for "host".] on default-azure
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

In the kitchen.log this is as:

I, [2019-11-18T15:25:11.639240 #25774]  INFO -- Kitchen: Your version of Terraform is out of date! The latest version
I, [2019-11-18T15:25:11.639273 #25774]  INFO -- Kitchen: is 0.12.15. You can update by downloading from www.terraform.io/downloads.html
I, [2019-11-18T15:25:24.157146 #25774]  INFO -- Kitchen: -----> Setting up <default-azure>...
I, [2019-11-18T15:25:24.160630 #25774]  INFO -- Kitchen: -----> Verifying <default-azure>...
E, [2019-11-18T15:25:24.181632 #25774] ERROR -- Kitchen: ------Exception-------
E, [2019-11-18T15:25:24.181686 #25774] ERROR -- Kitchen: Class: Kitchen::ActionFailed
E, [2019-11-18T15:25:24.181712 #25774] ERROR -- Kitchen: Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [Client error, can't connect to 'ssh' backend: You must provide a value for "host".] on default-azure

Possible Solution

No ideas? I can't seem to find any documentation about providing a target to InSpec via Kitchen :(

@clintoncwolfe
Copy link
Contributor

As I think you've discovered, this is dependent on inspec/kitchen-inspec#193

@williamayerst
Copy link
Author

Thanks for the quick reply :) 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants