Skip to content

Commit

Permalink
Merge pull request #10 from magodo/fix_provider_mismatch_crash
Browse files Browse the repository at this point in the history
Fix provider mismatch crash
  • Loading branch information
magodo committed Sep 30, 2021
2 parents d24b7ba + 1a105ed commit 3534bac
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 3534bac

Please sign in to comment.