Skip to content

ditrit/terrator-plugin

Repository files navigation

terrator-plugin

Quality Gate Status Reliability Rating Maintainability Rating Security Rating

Code Smells Bugs Vulnerabilities Technical Debt

Lines of Code Coverage Duplicated Lines (%)

Plugin for managing Terraform files in Leto-Modelizer.

Requirements

Build your plugin

npm run build

Grammar

We use the grammar from the official antlr4 grammar repository.

Legends
$\textcolor{green}{\textbf{\Large{✓}}}$ Full support
$\textcolor{orange}{\textsf{〜}}$ Partial support
$\textcolor{red}{\textbf{\textsf{X}}}$ Not supported but planned
Functionalities
resource $\textcolor{green}{\Large{✓}}$
data $\textcolor{green}{\Large{✓}}$
module $\textcolor{green}{\Large{✓}}$
provider $\textcolor{green}{\Large{✓}}$
output $\textcolor{orange}{\textsf{〜}}$
value $\textcolor{green}{\textbf{\Large{✓}}}$
description $\textcolor{green}{\textbf{\Large{✓}}}$
sensitive $\textcolor{green}{\textbf{\Large{✓}}}$
depends_on $\textcolor{red}{\textbf{\textsf{X}}}$
variable $\textcolor{orange}{\textsf{〜}}$
value $\textcolor{orange}{\textsf{〜}}$
default $\textcolor{green}{\textbf{\Large{✓}}}$
sensitive $\textcolor{green}{\textbf{\Large{✓}}}$
nullable $\textcolor{green}{\textbf{\Large{✓}}}$
validation $\textcolor{red}{\textbf{\textsf{X}}}$
type $\textcolor{orange}{\textsf{〜}}$
string $\textcolor{green}{\textbf{\Large{✓}}}$
bool $\textcolor{green}{\textbf{\Large{✓}}}$
number $\textcolor{green}{\textbf{\Large{✓}}}$
list $\textcolor{green}{\textbf{\Large{✓}}}$
set $\textcolor{green}{\textbf{\Large{✓}}}$
map $\textcolor{red}{\textbf{\textsf{X}}}$
object $\textcolor{red}{\textbf{\textsf{X}}}$
tuple $\textcolor{red}{\textbf{\textsf{X}}}$
locals $\textcolor{orange}{\textsf{〜}}$
string $\textcolor{green}{\textbf{\Large{✓}}}$
bool $\textcolor{green}{\textbf{\Large{✓}}}$
number $\textcolor{green}{\textbf{\Large{✓}}}$
list $\textcolor{green}{\textbf{\Large{✓}}}$
set $\textcolor{red}{\textbf{\textsf{X}}}$
object $\textcolor{red}{\textbf{\textsf{X}}}$
tuple $\textcolor{red}{\textbf{\textsf{X}}}$
map $\textcolor{red}{\textbf{\textsf{X}}}$
terraform $\textcolor{red}{\textbf{\textsf{X}}}$
provisionner $\textcolor{red}{\textbf{\textsf{X}}}$

Development

Generate the parser

We use antlr4 to generate the Terraform parser. Follow these steps from the official antlr4 repository to install it.

Make sure your CLASSPATH environment variable is set.

The default antlr4 executable path is set to /usr/local/lib/antlr-4.13.0-complete.jar on Linux and C:\Javalib\antlr-4.13.0-complete.jar on Windows.

You can use the ANTLR4_PATH environment variable to specify your own antlr4 executable path. For example, on Linux:

export ANTLR4_PATH="/usr/local/lib/antlr-4.11.0-complete.jar"

You can then run:

npm run parser:generate

How to release

We use Semantic Versioning as guideline for the version management.

Steps to release:

  • Create a new branch labeled release/vX.Y.Z from the latest main.
  • Increase the version number in package.json, package-lock.json and changelog.md.
  • Verify the content of the changelog.md.
  • Commit the modifications with the label Release version X.Y.Z.
  • Create a pull request on github for this branch into main.
  • Once the pull request validated and merged, tag the main branch with vX.Y.Z
  • After the tag is pushed, make the release on the tag in GitHub

Git: Default branch

The default branch is main. Direct commit on it is forbidden. The only way to update the application is through pull request.

Release tag are only done on the main branch.

Git: Branch naming policy

[BRANCH_TYPE]/[BRANCH_NAME]

  • BRANCH_TYPE is a prefix to describe the purpose of the branch. Accepted prefixes are:
    • feature, used for feature development
    • bugfix, used for bug fix
    • improvement, used for refacto
    • library, used for updating library
    • prerelease, used for preparing the branch for the release
    • release, used for releasing project
    • hotfix, used for applying a hotfix on main
  • BRANCH_NAME is managed by this regex: [a-z0-9._-] (_ is used as space character).