Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Set up Terraform with AWS

The first thing to set up is your Terraform. We will create an AWS IAM user for Terraform.

In your AWS console, go to the IAM section and create a user named “FullAccess”. Then add your user to a group named “FullAccessGroup”. Attaches to this group the following rights:

  • AdministratorAccess

  • AmazonEKSClusterPolicy

After these steps, AWS will provide you a Secret Access Key and Access Key IDSave them preciously because this will be the only time AWS gives it to you.

In your own console, create a ~/.aws/credentials file and put your credentials in it:

Code Block
[default]
 aws_access_key_id=***********
 aws_secret_access_key=****************************

The last step is to create this file:

Code Block
[default]
 region=eu-west-3

Set up and initialize your Terraform workspace

...

Code Block
git clone https://github.com/egovernments/eGovDIGIT-infraOpsDevOps.git
cd eGov-infraOpsDIGIT-DevOps/infra-as-code/terraform
Code Block
└── modules
    ├── db
    │   └── aws
    │       ├── main.tf
    │       ├── outputs.tf
    │       └── variables.tf
    ├── kubernetes
    │   └── aws
    │       ├── eks-cluster
    │       │   ├── main.tf
    │       │   ├── outputs.tf
    │       │   └── variables.tf
    │       ├── network
    │       │   ├── main.tf
    │       │   ├── outputs.tf
    │       │   └── variables.tf
    │       └── workers
    │           ├── main.tf
    │           ├── outputs.tf
    │           └── variables.tf
    └── storage
        └── aws
            ├── main.tf
            ├── outputs.tf
            └── variables.tf

...

Configuration in this directory creates set of RDS resources including DB instance, DB subnet group, and DB parameter group.

Storage Module:

Configuration in this directory creates EBS volume and attach attaches it together.

Set up an environment

Here, you will find five files used to provision a VPC, security groups, iam IAM users, storages, EKS cluster, s3 bucket. The final product should be similar to this:

...

  • s3 bucket: to store terraform state.

  • Network: VPC, security groups.

  • iam IAM users auth: using keybase to create admin, deployer, the user.

  • EKS cluster: with master(s) & worker node(s).

  • Storage(s): for es-master, es-data-v1, es-master-infra, es-data-infra-v1, zookeeper, kafka, kafka-infra.

...