-
Notifications
You must be signed in to change notification settings - Fork 146
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
Using variable_files var names in Inspec? #390
Comments
If you're using a yaml file as a lookup to serve as a variables file, for example: # yaml file
resource_group_name: mygroupname
location: centralus # tf file
locals {
settings = yamldecode(file("path/to/file.yml"))
}
resource "azurerm_resource_group" "group" {
name = local.settings.resource_group_name
location = local.settings.location
} ...then this is an easy win to call from InSpec in the form of an attributes file like this call from the kitchen.yml in the systems block:
But if you're just using a regular tfvars file, then it would be cool, if maybe during the The only problem is that you still have to declare those attributes in the InSpec test files like so: resource_group_name = attribute('resource_group_name')
location = attribute('location') Idk, might be cool, though. |
Also, @MattMencel , this kind of does what you need it to but you just don't want to explicitly copy it out again, right?:
|
@MattMencel Thank you for your interest in kitchen-terraform! I asked this question recently and currently there is only support for input variables inside kitchen.yml and not variables in variable_file. There is some discussion here: https://gitter.im/kitchen-terraform/Lobby?at=5df2504dc6ce6027ebab7478) I think Annie has an interesting idea as a potential workaround. |
Nice @anniehedgpeth! Using the yamldecode method with the attributes works great. |
Is this possible? I have my driver in kitchen.yaml configured like this...
For testing purposes, I've defined the
resource_group_name
as a variable and am sourcing other variables from the variable_files reference.In my Inspec test file I have a control like this...
The input for resource_group and vnet works fine, but inputs from variables in the
variable_files
reference do not work. For example when location is in the variables file...Is there a way to have this work?
The text was updated successfully, but these errors were encountered: