Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema: Account for short (Registry) module source address #94

Merged
merged 1 commit into from
Feb 24, 2022

Conversation

radeksimko
Copy link
Member

Prior to this patch we'd expect all module manifest entries to match exactly with the source value, which is true in most/all cases of local modules, but not in case of remote modules - esp. those in the TF Registry.

manifest entries

{
    "Modules": [
        {
            "Key": "eks_cluster",
            "Source": "registry.terraform.io/terraform-aws-modules/eks/aws",
            "Version": "18.2.2",
            "Dir": ".terraform/modules/eks_cluster"
        }
    ]
}

corresponding config

module "eks_cluster" {
  source  = "terraform-aws-modules/eks/aws"
  version = "18.2.2"
// ...
}

This therefore enables completion, hover, go-to-definition/reference etc. when remote modules from the Registry are involved:
2022-02-03 12 19 25

@@ -51,7 +51,7 @@ func (m *SchemaMerger) SchemaForModule(meta *module.Meta) (*schema.BodySchema, e
return nil, coreSchemaRequiredErr{}
}

if meta == nil || m.schemaReader == nil {
if meta == nil {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just makes testing a bit easier as less tests require provider schema.

@radeksimko radeksimko requested a review from a team February 3, 2022 12:22
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just questions about the code structure.

Feel free to merge any time

},
}

depSchema, err := schemaForDependentModuleBlock(module.LocalName, modMeta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the schemaForDependentModuleBlock call here as we already fetched depSchema in line 209?

schema/schema_merge.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants