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

fix: move from semaphore to rwmutex #215

Closed zach-source closed 12 months ago

zach-source commented 1 year ago

Description of your changes

Replaced the semaphore in the internal terraform harness with a RWMutex. RWMutex protects the terraform shared cache from corruption. If an init is performed, it requires a write lock. Only one write lock at a time. If another action is performed, a read lock is acquired. More than one read locks can be acquired. This prevents an init from inadvertently changing a plugin while it's in use. Prevents issues with text file busy errors. This is required if using max-reconcile-rate greater than 1.

Fixes #186

I have:

How has this code been tested

I've tested the code locally with a max reconcile rate of 4.

Upbound-CLA commented 1 year ago

CLA assistant check
All committers have signed the CLA.

ytsarev commented 1 year ago

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