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 for provider plugins does not work for staging #14

Closed
cforce opened this issue Oct 1, 2021 · 1 comment
Closed

mirror for provider plugins does not work for staging #14

cforce opened this issue Oct 1, 2021 · 1 comment

Comments

@cforce
Copy link

cforce commented Oct 1, 2021

https://github.com/ned1313/terraform-tuesdays/blob/main/2021-01-19-Mirroring/commands.sh

It does not work if you switch from one version to another as the
registry.terraform.io/hashicorp/azurerm/index.json
only has one(latest) version and so the cache only will use this ..even if more other versions would be available in the cache which is populated by history.
e.g

{
"versions": {
"2.78.0": {}
}
}

that network storage upload would need to merge the index

@ned1313
Copy link
Owner

ned1313 commented Oct 1, 2021

You are correct, if you were maintaining this on a networking mirror, you would probably need to do the following:

  1. Update the version used in code
  2. Run the terraform providers mirror command again with the same output directory
  3. Upload the resulting files (index.json will automatically be updated

I'm sure this solution could be scripted out and run as the version you use for providers is updated. You could also keep a set of terraform configs that only define the providers you use in your environment and run terraform providers mirror against each config with the same target output directory as mention in the official docs:

If you wish to create a mirror with providers for a number of different Terraform configurations, run terraform providers mirror in each configuration in turn while providing the same output directory each time. Terraform will then merge together all of the requirements into a single set of JSON indices.

https://www.terraform.io/docs/internals/provider-network-mirror-protocol.html#provider-mirror-as-a-static-website

@ned1313 ned1313 closed this as completed Oct 1, 2021
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

No branches or pull requests

2 participants