feat: Added support for adding providers through mach config directly without needing plugins #519
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant enhancements to the Terraform configuration generation process, focusing on enabling direct provider configurations, improving modularity, and adding support for provider requirements. The changes include adding new features, refactoring existing functionality, and updating templates to accommodate the new capabilities.
Enhancements to Terraform Provider Configuration:
.changes/unreleased/Added-20250627-152055.yaml
: Added support for defining providers directly in the Mach configuration without requiring plugins.internal/config/provider.go
: IntroducedProviderConfigs
andProviderConfig
types to manage provider configurations, including methods to retrieve provider names.internal/config/global.go
: AddedProviderConfigs
toTerraformConfig
and implemented logic to warn about duplicate provider names between plugins and provider configurations. [1] [2]internal/config/schemas/schema-1.yaml
: Updated the schema to includeprovider_configs
and defined the structure forProviderConfig
. [1] [2]Support for Provider Requirements:
internal/generator/requirements.go
: Added functionality to render provider requirements using a new template.internal/generator/templates/requirement.tmpl
: Created a template for rendering provider requirements.internal/generator/site.go
: Integrated provider requirements rendering into site-level Terraform configurations and resources. [1] [2]Updates to Terraform Component Tags and Variables:
internal/generator/component.go
: AddedComponentTags
tocomponentContext
and updated rendering logic to include tags and additional variables in Terraform configurations. [1] [2]internal/generator/templates/site_component.tmpl
: Updated templates to support rendering tags directly in the module configuration.Provider Rendering Enhancements:
internal/generator/providers.go
: Added functionality to render provider configurations using a new template.internal/generator/templates/provider.tmpl
: Created a template for rendering provider configurations.Dependency Updates:
go.mod
: Added thegithub.com/flosch/pongo2/v5
dependency to support template rendering.