mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
refactor getSchemas
This commit is contained in:
@@ -3,7 +3,6 @@ package command
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hashicorp/terraform/internal/terraform"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/terraform/internal/addrs"
|
||||
@@ -167,24 +166,14 @@ func (c *UntaintCommand) Run(args []string) int {
|
||||
}
|
||||
|
||||
// Get schemas, if possible, before writing state
|
||||
schemas := &terraform.Schemas{}
|
||||
path, err := os.Getwd()
|
||||
schemaErr := err != nil
|
||||
|
||||
if !schemaErr {
|
||||
config, diags := c.loadConfig(path)
|
||||
schemaErr = diags.HasErrors()
|
||||
|
||||
if !schemaErr {
|
||||
schemas, diags = getSchemas(&c.Meta, state, config)
|
||||
schemaErr = diags.HasErrors()
|
||||
var schemas *terraform.Schemas
|
||||
if isCloudMode(b) {
|
||||
schemas, diags = c.GetSchemas(state)
|
||||
if diags.HasErrors() {
|
||||
c.Ui.Warn(fmt.Sprintf(failedToLoadSchemasMessage, err))
|
||||
}
|
||||
}
|
||||
|
||||
if schemaErr && isCloudMode(b) {
|
||||
c.Ui.Warn(fmt.Sprintf(failedToLoadSchemasMessage, err))
|
||||
}
|
||||
|
||||
obj.Status = states.ObjectReady
|
||||
ss.SetResourceInstanceCurrent(addr, obj, rs.ProviderConfig)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user