A hyphen in the name
The label is legal and the reference is not, so the resource can never be used
resource "aws_s3_bucket" "my-logs" {}Check resource, data, module, variable and output names. One of these rules is a correctness problem rather than a style preference: a hyphen in a name makes the resource impossible to reference.
Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.
The answer appears here
Paste on the left and press Check. Nothing leaves this tab.
Nothing else to flag.
No formatting problems, and nothing the rules object to. Worth remembering what that covers: this reads the file you pasted, not the account or cluster it will be applied to.
No finding matches that filter.
Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.
The label is legal and the reference is not, so the resource can never be used
resource "aws_s3_bucket" "my-logs" {}Terraform rejects it, and neither block looks wrong on its own when they are in different files
resource "aws_s3_bucket" "logs" {}
resource "aws_s3_bucket" "logs" {}These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.
The label accepts it and a reference cannot: aws_instance.my-server.id parses as a subtraction. The resource can be declared and never used, and the error appears in a different file from the cause.
Instead:Use lower_snake_case. This is a correctness rule, not a style one.
aws_s3_bucket.bucket puts the word twice in every reference, plan line and error message, and carries no information about which bucket this is.
Instead:Name what distinguishes the instance, or main if there is only one.
web_1 through web_3 is the shape that becomes for_each later, and that refactor moves every resource in state. It gets more expensive the longer it is left.
Instead:Use for_each with a map keyed by something meaningful. Keys survive additions and removals; count indices renumber.
Terraform accepts almost any label. The constraints that matter come from how a name is used in a reference, and from what happens when the configuration grows.
aws_instance.my-server.id parses as a subtraction, so a resource with a hyphen in its name can be declared and never referred to. The error appears in whichever file tries to reference it, not in the file that declared it, which is why this survives review. This is the one rule on this page that breaks a configuration rather than making it inconsistent.
A leading digit is a parse error rather than a convention violation. Renaming to fix it is not free: Terraform sees a rename as a destroy and a create unless you add a moved block, so the fix has a state consequence.
aws_s3_bucket.bucket appears in every reference, every plan line and every error message with the word twice. The type is already in the address, so the name should carry what distinguishes this instance. main is a better default than the resource kind.
web_1, web_2 and web_3 are the shape that becomes count or for_each later, and that refactor moves every resource in state. Doing it at three is a small change; doing it at thirty is a migration with a maintenance window. for_each keyed by something meaningful also survives additions and removals in a way count indices do not, because removing the second of three count items renumbers the third.
Two blocks with the same type and name are an error, and when they are in different files neither looks wrong on its own. Terraform names both locations, which helps, and only after you have run it.
Whether the names are good, only whether they will work and whether they follow the common conventions. It also cannot see files you did not paste, so a duplicate split across two files is only found if both are here. Everything runs in your browser.