Coder Social home page Coder Social logo

g_terraform's Introduction

Caution

The .gitignore file is ignoring the backend.tf if you fork the repository make sure to comment the backend.tf

The Project

This repository is a lab to test Terraform/OpenTofu with EKS

TF Providers

  • hashicorp/aws
  • hashicorp/helm
  • hashicorp/kubernetes
  • gavinbunney/kubectl
  • cloudposse/tfstate-backend/aws
  • and more on each module

Modules

VPC

README

EKS

README

EBS CSi Driver

README

EKS External Secrets

README

EKS Load balancer controller

README

EKS RBAC default roles

README

Role create eks

README

How to start

Prepare your project

This command will install the providers needed for the project

terraform init

Create the tfvars file

Rename the terraform.tfvars.example file to terraform.tfvars. It has the a sample to use the project

mv terraform.tfvars.example terraform.tfvars

Create a role before create the EKS

Follow the steps on folder role-create-eks and create a role to create the EKS Cluster

cd role-create-eks
terraform init
terraform apply

Get the outputs to update the configurations

  • Update the provider.tf with the assume role
  • Put the auth_user/auth_role on the tfvars file to give access to your default user

Return to main project

cd ../

Creating the storage for tfstate and lock

To work as a team, and to the CI/CD is important to save the tfstate file of each environment

To work with the team, is important create a lock beatween everyone to noone run as same time the cloudformation, but create a pipeline is the best option

To save the state on S3 and use the dynamodb as lock, see the file tf-backend.tf and tf-backend-outputs.tf

Edit the tf-backend.tf with your informations. See the information of module: cloudposse/tfstate-backend

code tf-backend.tf

Run the apply for this resource to create the TF backend file

terraform apply -target=module.terraform_state_backend

After runned it, verify your backend.tf file

cat backend.tf

After verify the configuration generated by the module, run the init again to load the configuration

terraform init -force-copy

After create the EKS

Go to folder role-create-eks and delete the role

cd role-create-eks
terraform destroy

Return to main project

cd ../

Analyse the changes

This command will show the plan of execution with all changes

terraform plan

Apply all changes

This command will apply all changes maide in your IaC tf files to your environment

terraform apply

how to remove everything?

For exclude everything, use this command:

terraform destroy

g_terraform's People

Contributors

gustavoapolinario avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.