steampipe icon indicating copy to clipboard operation
steampipe copied to clipboard

unable to use env variable in connection resource: Function calls not allowed

Open 0xADD1E opened this issue 1 year ago • 6 comments

Further to turbot/pipe-fittings#149 (and the fix turbot/pipe-fittings#150)

It would be beneficial in some cases to be able to setup steampipe connection resources as follows

connection "googledirectory" {
  plugin = "googledirectory"
  token_path = env("CLOUDSDK_ADC_MYDOMAIN")
}

but when attempting to run, this yields

steampipe query
Error: Internal Error: Failed to load config: Function calls not allowed: Functions may not be called here.
(/Users/kaja/Documents/Code/Steampipe/config/googledirectory.spc:3,16-56)

Version info: Steampipe v1.0.0 on arm64 macOS 15.1 (24B82)

0xADD1E avatar Oct 24 '24 09:10 0xADD1E

Hey @0xADD1E it seems like Steampipe connections do not support functions currently.

The issue and the fix you have tagged are related to Flowpipe and not Steampipe. Flowpipe credentials currently support functions.

Hence I'm transferring this issue to the steampipe repo and marking it as a new Feature Request. This will be a good addition and we will work on it. Thanks for bringing this to our attention. 😊

pskrbasu avatar Oct 24 '24 10:10 pskrbasu

Hey @pskrbasu - apologies for the confusion, While the issue here is specific to Steampipe, I thought the config parser Steampipe used for connections was the same pipe-fittings/parse module that was used by Flowpipe (just connection.go instead of credential.go). Am I misunderstanding the module structure here, or is this saying there's a better way of doing this for Steampipe?

0xADD1E avatar Oct 24 '24 11:10 0xADD1E

Hey @0xADD1E

You are correct that Steampipe connection parsing happens in pipe-fittings. However the connection structure of Steampipe connections and Flowpipe/Powerpipe connections (PipelingConnections) is different - thus there is a different set of parsing code. This this problem is Steampipe specific.

At present the Steampipe connection parsing code does not support functions. This is more a for historical reasons rather than any technical reason and I certainly think it's reasonable to add this support. I don't foresee issues buit let me take a look into it

kaidaguerre avatar Oct 24 '24 12:10 kaidaguerre

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Dec 24 '24 08:12 github-actions[bot]

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Feb 23 '25 08:02 github-actions[bot]

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Apr 25 '25 08:04 github-actions[bot]

Resolved: https://github.com/turbot/pipe-fittings/pull/740 https://github.com/turbot/steampipe-plugin-sdk/pull/877

The following context functions are now supported in steampipe connection config: • abs • abspath • alltrue • anytrue • basename • base64decode • base64encode • base64gzip • base64sha256 • base64sha512 • bcrypt • can • ceil • chomp • cidrhost • cidrnetmask • cidrsubnet • cidrsubnets • coalesce • coalescelist • compact • concat • contains • csvdecode • dirname • distinct • element • endswith • chunklist • flatten • floor • format • formatdate • formatlist • indent • index • join • jsondecode • jsonencode • keys • length • list • log • lookup • lower • map • matchkeys • max • md5 • merge • min • one • parseint • pathexpand • pow • range • regex • regexall • replace • reverse • rsadecrypt • sensitive • nonsensitive • setintersection • setproduct • setsubtract • setunion • sha1 • sha256 • sha512 • signum • slice • sort • split • startswith • strcontains • strrev • substr • sum • textdecodebase64 • textencodebase64 • timestamp • timeadd • timecmp • title • transpose • trim • trimprefix • trimspace • trimsuffix • try • upper • urlencode • uuid • uuidv5 • values • yamldecode • yamlencode • zipmap • is_error • error_message • env

pskrbasu avatar Sep 24 '25 07:09 pskrbasu

@0xADD1E This feature is now available in Steampipe v2.2.0

pskrbasu avatar Sep 24 '25 10:09 pskrbasu