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

fix: change tofu unpacking to default to terraform registry #1001

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

pivotal-marcela-campo
Copy link
Member

@pivotal-marcela-campo pivotal-marcela-campo commented Apr 8, 2024

We are keeping the default provider registry as terraform's own registry for now instead
of switching to OpenTofu's. We had done this during pak but had still defaulting to opentofu registry
when unpacking which caused

  • the state to contained references to opentofu's registry instead, and
  • the terraform provider to unpak under a registry.opentofu.org directory instead of the expected registry.terraform.io directory.

With this change we expect to have only references to registry.terraform.io unless otherwise specified by the brokerpak both in

  • the state and
  • directory structure

Checklist:

  • Have you added or updated tests to validate the changed functionality?
  • Have you added Release Notes in the docs repositories?
  • Have you followed the Conventional Commits specification?

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/187390468

The labels on this github issue will be updated when the story is started.

pivotal-marcela-campo and others added 2 commits April 8, 2024 17:19
when reading a brokerpak and creating the plugins folder, we were
defaulting the domain of the providers to registry.opentofu.org instead
of registry.terraform.io. This was not consistent with our default for
the download location, which is registry.terraform.io.
It now defaults to terraform registry in both places. This means
brokerpaks which don't indicate any domain in their provider definitions
in the manifest.yml file, will need to fully qualify the provider in the
required_providers block to avoid errors, as OpenTofu will default to
the opentofu registry.

[#187379198](https://www.pivotaltracker.com/story/show/187379198)
when fixing [this issue in tofu](opentofu/opentofu#1139)
some logic was introduced to change the hostname of the providers to
[#187199940](https://www.pivotaltracker.com/story/show/187199940) point
to the opentofu registry (in-memory)  when executing a show, if the
terraform code didn't specify a hostname in the provider's block.
However this functionality seems to be buggy and it is renaming
providers regardless, which breaks the tf_attribute_skip functionality.

A way to disable this rename is to set the OPENTOFU_STATEFILE_PROVIDER_ADDRESS_TRANSLATION
environment variable to `0`. This PR implements that
workaround for the broker.

[#187379198](https://www.pivotaltracker.com/story/show/187379198)

Co-authored-by: Felisia Martini <[email protected]>
@pivotal-marcela-campo pivotal-marcela-campo force-pushed the fix_default_tofu_unpacking branch from 7ba2d4b to b05f8a6 Compare April 8, 2024 16:19
Copy link
Member

@blgm blgm left a comment

Choose a reason for hiding this comment

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

In the comment:

We are keeping the default provider registry as terraform's own registry for now instead
of switching to terraform.

Presumably the last word should be OpenTofu?

go.mod Outdated Show resolved Hide resolved
@pivotal-marcela-campo pivotal-marcela-campo changed the title fix: fix default tofu unpacking fix: change tofu unpacking to default to terraform registry Apr 9, 2024
@pivotal-marcela-campo pivotal-marcela-campo merged commit 9848ca2 into main Apr 9, 2024
8 checks passed
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.

4 participants