Closed andymadge closed 1 month ago
Hi andymadge, Apologies that you are facing this issue. We tried to reproduce it on our end, but everything works fine for us. Could you please check if the variable mandatory_tags is defined in the (controls/mandatory.sp) file? That might be the cause of the issue.
Thanks.
Hi @khushboo9024 ,
Yes the variable is definitely defined. It must be because it works for the defaults.
The file contains:
variable "mandatory_tags" {
type = list(string)
description = "A list of mandatory tags to check for."
default = ["Environment", "Owner"]
}
If I run:
powerpipe benchmark run aws_tags.benchmark.mandatory
I get output like this (I've redacted the account numbers):
+ CloudTrail trails should have mandatory tags .......................................................................................................................... 2 / 2 [= ]
| |
| ALARM: OrganisationTrail is missing tags: Environment, Owner. ......................................................................................................... eu-west-2 ************
| ALARM: OrganisationTrail is missing tags: Environment, Owner. ......................................................................................................... eu-west-1 ************
If I modify the file /Users/andym/powerpipe/aws-tags/.powerpipe/mods/github.com/turbot/steampipe-mod-aws-tags@v0.13.0/controls/mandatory.sp
by adding an extra value to the default:
variable "mandatory_tags" {
type = list(string)
description = "A list of mandatory tags to check for."
default = ["Environment", "Owner", "Testing"]
}
That behaves as expected and checks the new value:
+ CloudTrail trails should have mandatory tags .......................................................................................................................... 2 / 2 [= ]
| |
| ALARM: OrganisationTrail is missing tags: Environment, Owner, Testing. ................................................................................................ eu-west-2 ************
| ALARM: OrganisationTrail is missing tags: Environment, Owner, Testing. ................................................................................................ eu-west-1 ************
I've started a new project from scratch as follows:
$ mkdir test
$ cd test
$ powerpipe mod init
Created mod definition file '/Users/andym/powerpipe/test/mod.pp'
$ powerpipe mod install github.com/turbot/steampipe-mod-aws-tags Installed 1 mod:
local
└── github.com/turbot/steampipe-mod-aws-tags@v0.13.0
This makes no difference.
Running powerpipe benchmark run aws_tags.benchmark.mandatory
works properly.
Running powerpipe benchmark run aws_tags.benchmark.mandatory --var 'mandatory_tags=["Application", "Environment", "Department", "Owner"]'
fails with the error
I've just been reading this:
Passing Variables for Dependency Mods A Powerpipe mod can depend on other mods, and those dependency mods may include variables that you would like to pass. To set them, prefix the variable names with the mod alias and then set them like any other variable.
It doesn't seem like this should be relevant, because everything here is within a single mod, but I though I'd give it a try, and it worked.
I changed the variable name in the command from mandatory_tags
to aws_tags.mandatory_tags
like this:
powerpipe benchmark run aws_tags.benchmark.mandatory --var 'aws_tags.mandatory_tags=["Application", "Environment", "Department", "Owner"]'
And it now runs without the error.
Does this help to diagnose why the normal command doesn't work?
@andymadge Thanks for figuring this out, and apologies for the trouble caused by the wrong syntax in the command. We will update it as soon as possible. Thanks.
Didn't you say it worked for you though? Does that mean there's something different in my config somewhere causing it to not work?
@andymadge I was checking from my existing cloned repo, and it worked fine there. I was able to reproduce the issue by following the steps mentioned by you above. Thanks.
FYI I've discovered exactly the same issue exists in the aws-thrifty repo
Apologies for the late reply. Thank you, @andymadge, for the information. We will update the aws-thrifty repo docs as well.
Describe the bug When trying to set variables for a benchmark I get an error:
Powerpipe version (
powerpipe -v
) Powerpipe v0.4.0Steampipe version (
steampipe -v
) Steampipe v0.23.2Plugin version (
steampipe plugin list
) hub.steampipe.io/plugins/turbot/aws@0.138.0 github.com/turbot/steampipe-mod-aws-tags@v0.13.0To reproduce
Output is the following error:
Expected behavior Benchmark should run correctly without the error
Additional context If I try to set the variable in file
steampipe.spvars
I get the following similar error, but the benchmark does run, albeit with the default variable values.The same issue happens for all the benchmarks, and all variables I have tried, including: