Skip to content

Commit

Permalink
schema: Remove duplicate code from SchemaMerger (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko authored Feb 25, 2022
1 parent b1b7f37 commit faadc57
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions schema/schema_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (m *SchemaMerger) SchemaForModule(meta *module.Meta) (*schema.BodySchema, e

// There's likely more edge cases with how source address can be represented in config
// vs in module manifest, but for now we at least account for the common case of TF Registry
if strings.HasPrefix(module.SourceAddr, "registry.terraform.io/") {
if err == nil && strings.HasPrefix(module.SourceAddr, "registry.terraform.io/") {
shortName := strings.TrimPrefix(module.SourceAddr, "registry.terraform.io/")

depKeys := schema.DependencyKeys{
Expand All @@ -230,10 +230,7 @@ func (m *SchemaMerger) SchemaForModule(meta *module.Meta) (*schema.BodySchema, e
},
}

depSchema, err := schemaForDependentModuleBlock(module.LocalName, modMeta)
if err == nil {
mergedSchema.Blocks["module"].DependentBody[schema.NewSchemaKey(depKeys)] = depSchema
}
mergedSchema.Blocks["module"].DependentBody[schema.NewSchemaKey(depKeys)] = depSchema
}
}
}
Expand Down

0 comments on commit faadc57

Please sign in to comment.