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

Mirror plugins during build #93

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

tamirkamara
Copy link
Contributor

Fixes #90.

When we build the bundle we can and should mirror the plugins terraform would use in runtime so that the bundle will be more self sufficient and won't need to access Terraform/Hashicorp endpoints to download things.

@getporterbot getporterbot added this to In Progress in Porter and Mixins Aug 31, 2022
Signed-off-by: Tamir Kamara <26870601+tamirkamara@users.noreply.github.com>
@tamirkamara
Copy link
Contributor Author

@carolynvs I've tested this in a basic way but if easy enough I would have liked to take it into our harden environment and run it there. Is it possible to package the mixin as a file and then have porter mixin install it via a file path and not a URL?

@tamirkamara tamirkamara marked this pull request as ready for review August 31, 2022 19:14
@carolynvs
Copy link
Member

@tamirkamara You can install the mixin from source with mage build install. Afterwards you can copy ~/.porter/mixins/terraform to another machine (has to be the same OS/ARCH).

@tamirkamara
Copy link
Contributor Author

@carolynvs looks like it also works in our constraint environment. Can you please reivew?

@carolynvs carolynvs self-assigned this Sep 8, 2022
Copy link
Member

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

I tried this out with a test bundle and it seems there there is more configuration required to make this work. It didn't work for me and still downloaded the providers.

Is there more that needs to be done to make this work? Maybe some configuration file changes? If we are going to unconditionally mirror the providers, then the mixins should configure the bundle to automatically take advantage of those files.

@tamirkamara
Copy link
Contributor Author

I tried this out with a test bundle and it seems there there is more configuration required to make this work. It didn't work for me and still downloaded the providers.

@carolynvs can you explain how and where you saw it downloaded the providers?
I have run this in an environment where at runtime porter can't access terraform/hashicorp domains and everything worked just fine. The providers were downloaded at build time and saved in the image.

@carolynvs
Copy link
Member

I was getting confused by this output:

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of hashicorp/azurerm from the dependency lock file
- Installing hashicorp/azurerm v2.72.0...
- Installed hashicorp/azurerm v2.72.0 (unauthenticated)

It was taking a long time and I assumed it was installing the providers again. I just tried again with my network unplugged and confirmed that it is in fact using the mirrored providers. 👍

Copy link
Member

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

Thank you for making this feature work much better in airgapped scenarios!

@carolynvs carolynvs merged commit 67e26af into getporter:main Sep 9, 2022
Porter and Mixins automation moved this from In Progress to Done Sep 9, 2022
@tamirkamara tamirkamara deleted the 90-mirror-in-build branch September 9, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Use terraform provider mirror at buildtime?
2 participants