The product is for anyone who uses terraform to manage their AWS infrastructure and would like to know how best they can optimise their cloud infrastucture in order to save costs.
It is a command line tool that flags optimisation oppurtunities detected by Cloudfix for the resources that have been deployed using terraform. It'll either flag the specific attribute within the resource that needs to be changed (along with what it needs to be changed to), or in the case that such an attribute does not exist, describe the oppurtunity against the name of the resource about which the oppurtunity is present.
- An active cloudfix account at https://app.cloudfix.com/
- Resources deployed on AWS using terraform for which you would like to see reccomendations.
Note: For CLI version v3.0.0 and above refer to this readme
-
Run command
wget -O - https://github.com/trilogy-group/cloudfix-linter/releases/download/v2.0.3/install.sh | bash
-
Ensure that terraform can access your AWS account. You can user one of the following
- Devconnect with saml2aws
- Set the access key and the secret key inside of the provider "aws" block eg: in the main.tf file provider "aws" { region = "us-east-1" access_key = "my-access-key" secret_key = "my-secret-key" }
- Set and export AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY , AWS_SESSION_TOKEN as enviroment variables. More information on how to give access can be found here
-
This version works with CloudFix v3 so make sure you have credentials to https://app.cloudfix.com/
-
Open the folder with your terraform files as the rootfolder.
Wrong setup :The rootfolder does not contain the terrafrom files, instead terraform-dev-setup/s3 has the terraform files, extension does not supports such file heirarchy.
Correct Setup :The rootfolder S3-Buckets has the terraform files directly under it.
-
From your terraform code working directory do "cloudfix-linter init".
cd my-terraform-project cloudfix-linter init cloudfix-linter --help
-
Run "terraform apply" to deploy the resources from your terraform code working directory. Currently he CLI uses terraform version 1.2.6 which it downloads itself, this maybe not be compatible with your terraform version. To avoid conflicts with your local terraform version we recommend using the bundled terraform. If your current working directory is the project root then run the follow commands to use the bundled terraform. Video demo
cloudfix-linter/terraform init cloudfix-linter/terraform apply
-
To get recommendations from cloudfix and see them through CLI run command "cloudfix-linter flagRecco"
Note :- If you make any changes to your terraform code, You first have to deploy them using terraform apply
and then run “cloudfix-linter” command again through working directory of your terraform code to see reccomendations being flagged according to recent changes.
Note:- If you do not have terraform code template to test this tool. You can use this demo
The project uses a custom ruleset written for TfLint to flag reccomendations from cloudfix. The github repo for the ruleset releases can be accessed [here] (https://github.com/trilogy-group/tflint-ruleset-template)
See the Github action file for details.