Class: Terracop::Cop::Style::DashInResourceName
- Defined in:
- lib/terracop/cop/style/dash_in_resource_name.rb
Overview
Note:
When you rename a resource terraform will destroy and recreate it. Use ‘terraform mv` on the state file to avoid this from happening.
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.
Constant Summary collapse
- MSG =
'Use underscores in terraform resource names instead of dashes.'
Instance Attribute Summary
Attributes inherited from Base
#attributes, #index, #name, #offenses, #type
Instance Method Summary collapse
Methods inherited from Base
config, cop_name, #human_name, #initialize, #offense, run
Constructor Details
This class inherits a constructor from Terracop::Cop::Base
Instance Method Details
#check ⇒ Object
27 28 29 30 31 |
# File 'lib/terracop/cop/style/dash_in_resource_name.rb', line 27 def check return unless name.index('-') offense(MSG) end |