Class: Terracop::Cop::Style::SnakeCase
- Defined in:
- lib/terracop/cop/style/snake_case.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 terraform resource names that are using CamelCase or in general, contain capital letters. Terraform prefers snake_case.
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
26 27 28 29 30 31 |
# File 'lib/terracop/cop/style/snake_case.rb', line 26 def check # Allow dashes here as there is another cop to complain about that. return if name =~ /^[\da-z_\-]+$/ offense 'Use snake_case for resource names.' end |