class Terracop::Cop::Style::DashInResourceName

This cop checks for the use of dashes in terraform resource names. Terraform uses underscores for resource types and attributes. Using dashes for resource names makes for awkward combinations.

@example

# bad
resource "aws_security_group" "load-balancer" { }

# good
resource "aws_security_group" "load_balancer" { }

@note

When you rename a resource terraform will destroy and recreate it.
Use `terraform mv` on the state file to avoid this from happening.

Constants

MSG

Public Instance Methods

check() click to toggle source
# File lib/terracop/cop/style/dash_in_resource_name.rb, line 27
def check
  return unless name.index('-')

  offense(MSG)
end