Better control over infracost integration

Currently to enable infracost, two things are necessary:

  1. add the infracost label to a stack

  2. set the INFRACOST_API_KEY environment variable

In order to disable infracost for specific situations (e.g. local preview run or drift detection run), one has to manipulate the INFRACOST_API_KEY environment variable in order to prevent the call from happening.

It would be good to have better control over this, and not have to manipulate the INFRACOST_API_KEY environment variable (which I assume will still make the call to infracost, and Infracost will block it because of the bad API key).

```
[[ "$TF_VAR_spacelift_run_trigger" = "spacelift/drift_detection" || "$TF_VAR_spacelift_local_preview" = "true" ]] && export INFRACOST_API_KEY=disabled && export INFRACOST_WARN_ON_FAILURE=true || true
```


It would be nice to have an INFRACOST_ENABLED environment value that is possible to configure on the fly, which would prevent the calls from actually made and allowing us better control over the infracost integration.

Workaround
Manipulate the INFRACOST_API_KEY environment variable
Problem
Turning off Infracost for specific situations is not convenient

Please authenticate to join the conversation.

Upvoters
Status

πŸ”­ Discovery

Board

πŸ’‘ Feature Requests

Tags

Integrations

Date

About 2 months ago

Subscribe to post

Get notified by email when there are changes.