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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
crash.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
#
*.tfvars
Expand All @@ -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

30 changes: 15 additions & 15 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
config {
module = true
}

plugin "aws" {
enabled = true
version = "0.12.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

rule "terraform_naming_convention" {
enabled = true
}
rule "terraform_typed_variables" {
enabled = true
}
rule "terraform_unused_required_providers" {
enabled = true
}
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

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

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

89 changes: 60 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
# EC2-Minikube

## Architecture

![Architecture](images/architecture.drawio.png)

## Pre-requisite
- yq on your host instance, go [here](https://github.com/mikefarah/yq) to install

## Usage

### Provisioning the Infrastructure

```bash
terraform apply
```

### Connecting to the k8s cluster

You can export the Kubeconfig file using this helper
```bash
$(terraform output -raw kubeconfig_command)
```

### Checking the connection

```bash
kubectl cluster-info
```
# EC2-Minikube

## Architecture

![Architecture](images/architecture.drawio.png)

## Usage

### Set up the aws Cli

Use your access key and secret access key to authenticate

```bash
aws configure
```

### Add execution permission on "downoad_kubeconfig" script

```bash
sudo chmod +x ./scripts/download_kubeconfig.sh
```

### 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

sudo apt-get install yq
```

### Check your provisioning plan

```bash
terraform plan
```

### Provisioning the Infrastructure

```bash
terraform apply
```

### Connecting to the k8s cluster "check output"

You can export the Kubeconfig file using this helper

```bash
$(terraform output -raw kubeconfig_command)
```

### Checking the connection

```bash
kubectl cluster-info
```

### You can validate and check your Iac with TFlint

```bash
make verify
```
Loading