upbound / provider-terraform

A Crossplane provider for Terraform
https://marketplace.upbound.io/providers/upbound/provider-terraform/
Apache License 2.0
150 stars 59 forks source link

BUGFIX: keep environment when plugin cache enabled #143

Closed ytsarev closed 1 year ago

ytsarev commented 1 year ago

Description of your changes

Relates to #109 where we are modifying cmd.Env to enable terraformrc

Before this fix the environment would be stripped with default pluginCache: true

In standard k8s backend scenarion the Worskpace is failing with

Terraform encountered an error. Summary: Failed to initialize kubernetes configuration: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable.

This change always preserves the environment for cmd.Env keeping filtering out of TF_PLUGIN_CACHE_DIR within the loop.

I have:

How has this code been tested

 k apply -f examples/transition/00-mr-tf-workspace/workspace-inline.yaml
ytsarev commented 1 year ago

/test-examples="examples/transition/00-mr-tf-workspace/workspace-inline.yaml"

ytsarev commented 1 year ago

/test-examples="examples/workspace-inline-aws.yaml"