terraform/internal/registry
Martin Atkins 51b0aee36c addrs: ModuleRegistryPackage for representing module registry packages
Previously we had a separation between ModuleSourceRemote and
ModulePackage as a way to represent within the type system that there's an
important difference between a module source address and a package address,
because module packages often contain multiple modules and so a
ModuleSourceRemote combines a ModulePackage with a subdirectory to
represent one specific module.

This commit applies that same strategy to ModuleSourceRegistry, creating
a new type ModuleRegistryPackage to represent the different sort of
package that we use for registry modules. Again, the main goal here is
to try to reflect the conceptual modelling more directly in the type
system so that we can more easily verify that uses of these different
address types are correct.

To make use of that, I've also lightly reworked initwd's module installer
to use addrs.ModuleRegistryPackage directly, instead of a string
representation thereof. This was in response to some earlier commits where
I found myself accidentally mixing up package addresses and source
addresses in the installRegistryModule method; with this new organization
those bugs would've been caught at compile time, rather than only at
unit and integration testing time.

While in the area anyway, I also took this opportunity to fix some
historical confusing names of fields in initwd.ModuleInstaller, to be
clearer that they are only for registry packages and not for all module
source address types.
2021-06-03 08:50:34 -07:00
..
regsrc addrs: ModuleRegistryPackage for representing module registry packages 2021-06-03 08:50:34 -07:00
response Move registry/ to internal/registry/ 2021-05-17 14:09:07 -07:00
test Move httpclient/ to internal/httpclient/ 2021-05-17 14:09:07 -07:00
client.go Move httpclient/ to internal/httpclient/ 2021-05-17 14:09:07 -07:00
client_test.go Move httpclient/ to internal/httpclient/ 2021-05-17 14:09:07 -07:00
errors.go Move registry/ to internal/registry/ 2021-05-17 14:09:07 -07:00