cloudquery / plugin-sdk

CloudQuery Go SDK for source and destination plugins
Mozilla Public License 2.0
22 stars 24 forks source link

Bug(env-expanding): Commented env variables should not be expanded #613

Closed erezrokah closed 1 year ago

erezrokah commented 1 year ago

Describe the bug

Given the following configuration:

kind: source
spec:
  name: "azure"
  path: "cloudquery/azure"
  version: "v3.3.0"
  tables: ["*"]
  destinations: ["postgresql"]
  concurrency: 1000
  spec:
    subscriptions:
      - 21e0d134-5da8-4754-8587-c58425d93de5
---
kind: destination
spec:
  name: "postgresql"
  path: "cloudquery/postgresql"
  version: "v2.0.5"
  write_mode: "overwrite-delete-stale"
  spec:
    # connection_string: ${TEST_STRING}
    connection_string: postgresql://postgres:pass@localhost:5432/postgres

Running cloudquery sync <path-to-config> you get an error if the TEST_STRING variable is not set

Expected Behavior

Don't fail on missing env vars in comments

Steps to Reproduce

Run cloudquery sync with the provider configuration

Possible Solution

Ignore comments when expanding env variables

Provider and CloudQuery version

cloudquery version 2.1.0

Additional Context

No response

hermanschaaf commented 1 year ago

Related to https://github.com/cloudquery/cloudquery/issues/14599 (this problem was also mentioned in a comment there)

yevgenypats commented 1 year ago

I'll reply the same as https://github.com/cloudquery/cloudquery/issues/14599. I don't think this is something we need to solve as it's a product on it's own. i.e: "smart context based variable expansion".

I think a documentaiton on how variable expansion works: 1) plain search and replace 2) specify what are the limitation

should solve both those issues.