Skip to content

Commit

Permalink
fix provider mismatch crash
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo committed Sep 30, 2021
1 parent d24b7ba commit 1a105ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/meta/hcl_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ func tuneHCLSchemaForResource(rb *hclwrite.Body, sch *schema.Schema) error {

func tuneForBlock(rb *hclwrite.Body, sch *schema.SchemaBlock, parentAttrNames []string) error {
for attrName, attrVal := range rb.Attributes() {
schAttr := sch.Attributes[attrName]
schAttr, ok := sch.Attributes[attrName]
if !ok {
// This might because the provider under used is a newer one than the version where we ingest the schema information.
// This might happen when the user have some newer version provider installed in its local fs.
// We simply remove that attribute from the config.
rb.RemoveAttribute(attrName)
continue
}
if schAttr.Required {
continue
}
Expand Down

0 comments on commit 1a105ed

Please sign in to comment.