Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using modules & adding tflint #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ELBouslama
Copy link

restructuring the code into a modular block (using terraform modules for integrity and simplicity)

  • adding TFlint to verify the contents of the configuration as well as the syntax and structure, (e.g. that a AWS EC2 instance type is valid,etc).
  • Adding Iac Makefile for validating terraform configuration files before planing/applying.

@@ -31,4 +31,4 @@ override.tf.json

# Ignore CLI configuration files
.terraformrc
terraform.rc
terraform.rc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to put an empty line at the end of file

terraform fmt
terraform validate
tflint .
echo "********** Verication done ************ "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line at the end of file

install_lint :
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash

verify : install_lint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should check if tflint exists we don't have to reinstall it

### Install yq , yaml template engine .

```bash
sudo add-apt-repository ppa:rmescandon/yq
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're assuming that people have ubuntu here 😂, just put a link to the repo and they would install it from there depending on their platform

instance_id = aws_instance.minikube_instance.id
allocation_id = aws_eip.instance_elastic_ip.id
}
data "aws_ami" "ubuntu" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project is already a module if we put it in a different project with the repo link as a source.
Since we don't have any other module it doesn't make a lot of sense to put it inside a modules folder

@@ -17,10 +17,4 @@ chmod 400 $TMP_PEM_FILE
# Getting the KuebConfig
ssh -i $TMP_PEM_FILE -o StrictHostKeyChecking=no $REMOTE_USER@$REMOTE_ADDR "sudo cat /root/.kube/config" >$TMP_KUBECONFIG

if ! command -v yq &> /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed these checks which are quite helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants