Skip to content

Commit

Permalink
set only corresponding provider in provider config file
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxu92 committed Oct 19, 2023
1 parent f298c4f commit a155e4b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/meta/base_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,17 @@ func (meta *baseMeta) buildTerraformConfig(backendType string) string {

func (meta *baseMeta) buildProviderConfig() string {
f := hclwrite.NewEmptyFile()
body := f.Body().AppendNewBlock("provider", []string{"azurerm"}).Body()

var body *hclwrite.Body
if meta.useAzAPI() {
body = f.Body().AppendNewBlock("provider", []string{"azapi"}).Body()
} else {
body = f.Body().AppendNewBlock("provider", []string{"azurerm"}).Body()
}
body.AppendNewBlock("features", nil)
for k, v := range meta.providerConfig {
body.SetAttributeValue(k, v)
}

if meta.useAzAPI() {
f.Body().AppendNewBlock("provider", []string{"azapi"}).Body()
}
return string(f.Bytes())
}

Expand Down

0 comments on commit a155e4b

Please sign in to comment.