Skip to content

Fix for "invalid Schema.Elem 1; need *Schema or *Resource" - #3429

Merged
bflad merged 1 commit into
hashicorp:masterfrom
squidfunk:fix/invalid-nested-element-types
Jun 27, 2018
Merged

bflad merged 1 commit into
hashicorp:masterfrom
squidfunk:fix/invalid-nested-element-types

Conversation

@squidfunk

Copy link
Copy Markdown
Contributor

I'm currently trying to extract the schema from the AWS provider to build an autocomplete provider for Atom, but Terraform panics at this location: https://github.com/hashicorp/terraform/blob/3253367c64ace91aa0f6c3abaaae66721f9b88a3/helper/schema/core_schema.go#L42-L50

I tracked the error down and found that some element types don't have schema definitions attached to them but reference types directly, like this:

Elem: schema.TypeString,

This fixes the error and seems consistent with the rest of the library:

Elem: &schema.Schema{Type: schema.TypeString},

This PR fixes all resources that trigger this error.

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Feb 18, 2018
@radeksimko radeksimko added thinking upstream-terraform Addresses functionality related to the Terraform core binary. labels Feb 19, 2018
@ewbankkit

Copy link
Copy Markdown
Collaborator

See also #2914.

@squidfunk

Copy link
Copy Markdown
Contributor Author

@ewbankkit Great, so this is already a known issue. Note that the linked PR misses the fix for aws/resource_aws_glue_catalog_database.go which is included in this one. Any ETA for a fix to land in master?

@bflad bflad added this to the v1.26.0 milestone Jun 27, 2018
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. and removed thinking upstream-terraform Addresses functionality related to the Terraform core binary. labels Jun 27, 2018

@bflad bflad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Everything fell into place for #2914 so this pull request was good to go as well. On top of master after #2914 the only real change here was fixing aws_glue_catalog_database, which passes acceptance testing. Thanks @squidfunk! 🚀

make testacc TEST=./aws TESTARGS='-run=TestAccAWSGlueCatalogDatabase'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSGlueCatalogDatabase -timeout 120m
=== RUN   TestAccAWSGlueCatalogDatabase_importBasic
--- PASS: TestAccAWSGlueCatalogDatabase_importBasic (13.32s)
=== RUN   TestAccAWSGlueCatalogDatabase_full
--- PASS: TestAccAWSGlueCatalogDatabase_full (27.81s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	41.185s

@bflad
bflad merged commit 285fb0e into hashicorp:master Jun 27, 2018
@ghost

ghost commented Apr 4, 2020

Copy link
Copy Markdown

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. size/M Managed by automation to categorize the size of a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

⌂ 换网址