broad-zoo-34077
10/08/2021, 3:18 AMfaint-mouse-18716
10/08/2021, 3:19 AMError: --config-file flag cannot be used with the following flags or equivalent environment variables: --path, --terraform-*, --usage-file
My Azure pipeline script hews quite closely to the example:faint-mouse-18716
10/08/2021, 3:20 AMfaint-mouse-18716
10/08/2021, 3:22 AMRunning infracost breakdown using:
line shows what looks like a normal invocation that does not specify any of the reported conflicting flags.
• I’m able to run infracost breakdown --no-color --format json --config-file terraform/infracost.yml
(the reported invocation from the error message) on a local machine just fine, this only breaks in the Azure Pipeline
• The directory structure looks roughly like this, with the workspace paths properly specified in infracost.yml
|- repo/
|- <other dirs>
|- terraform/
|- workspaces/
|- a/
|- b/
|- <more workspaces>
|- infracost.yml
faint-mouse-18716
10/08/2021, 3:22 AMlittle-author-61621
INFRACOST_TERRAFORM_CLOUD_TOKEN
env var and updating your config YAML to be something like:
version: 0.1
projects:
- path: path/to/code
terraform_cloud_token: $TF_CLOUD_API_KEY
Then adding these lines to the bash step of the pipeline:
envsubst < terraform/infracost.yml > terraform/infracost-updated.yml
mv terraform/infracost-updated.yml terraform/infracost.yml
little-author-61621
faint-mouse-18716
10/08/2021, 12:26 PMfaint-mouse-18716
10/08/2021, 2:02 PMlittle-author-61621