Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable terraform provider plugin cache #123

Merged
merged 4 commits into from
Nov 3, 2022

Conversation

ytsarev
Copy link
Collaborator

@ytsarev ytsarev commented Nov 3, 2022

Description of your changes

Implement control over https://developer.hashicorp.com/terraform/cli/config/config-file#provider-plugin-cache and enable it by default.

ProviderConfig.Spec is extended with the optional pluginCache field which is true by default.

Fixes #122

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Creating a couple of Workspaces with aws provider dependency.

Directory sizes within the controller pod with providerCache: false:

du -sh /tf/*
237.0M	/tf/28f8bf14-8e51-4577-b2f8-8059f80794c4
237.0M	/tf/4669c743-43f6-468d-9563-bce2c2fb59fb

It is visible that aws provider binary is fetched to both of workplaces

Directory sizes within the controller pod with providerCache: true:

 du -sh /tf/*
72.0K	/tf/4669c743-43f6-468d-9563-bce2c2fb59fb
68.0K	/tf/c4ed7b69-21d8-42a0-8910-80a3c39424ff
72.0K	/tf/f390d499-661c-463c-be8c-831363560a66
237.0M	/tf/plugin-cache

It is visible that only /tf/plugin-cache contains the actual provider binary and the Workspace directories are becoming very lightweight.

The workspaces are fine and operational

k get workspaces
NAME                      READY   SYNCED   AGE
iamrole-terraform-test3   True    True     11m
iamrole-terraform-test2   True    True     9m53s

Fixes crossplane-contrib#122

Signed-off-by: Yury Tsarev <yury@upbound.io>
* Enable control over PluginCache functionality
* Still enable it by default

Signed-off-by: Yury Tsarev <yury@upbound.io>
Otherwise we have to reset provider pod to activate
`pluginCache: false`

Signed-off-by: Yury Tsarev <yury@upbound.io>
Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev ytsarev requested a review from bobh66 November 3, 2022 01:08
Copy link
Collaborator

@bobh66 bobh66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@ytsarev ytsarev merged commit 6b41a19 into crossplane-contrib:master Nov 3, 2022
@ytsarev ytsarev deleted the plugin-cache branch November 3, 2022 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable terraform provider plugin cache by default
2 participants