- VPC: Creates a Virtual Private Cloud (VPC) with subnets, routing, and networking configurations.
- EKS: Provisions an Amazon Elastic Kubernetes Service (EKS) cluster with managed node groups.
- Security-Group: Sets up a security group for access from the EKS cluster to the database.
- RDS: Deploys an Amazon RDS database instance.
- Elasticache-Redis: Creates a Redis MemoryDB cluster.
- EC2: Creates en EC2 instance
Before running this Terraform code, ensure you have the following prerequisites in place: Terraform CLI is installed on your local machine.
Follow the steps below to deploy the infrastructure:
Example EKS cluster:
## Module
module "terraform-seqera-aws" {
source = "github.com/seqeralabs/terraform-seqera-aws"
region = "eu-west-2"
## VPC
vpc_name = "my-seqera-tf-vpc"
## EKS
cluster_name = "my-seqera-tf-cluster"
cluster_version = "1.27"
eks_managed_node_group_defaults_instance_types = ["t3.medium"]
eks_managed_node_group_defaults_capacity_type = "ON_DEMAND"
eks_aws_auth_roles = [
"arn:aws:iam::1234567890123:role/MyIAMRole",
]
eks_aws_auth_users = [
"arn:aws:iam::1234567890123:user/MyIAMUSer"
]
default_tags = {
Environment = "myenvironment"
ManagedBy = "Terraform"
Product = "Seqera"
}
}
## Outputs
output "database_url" {
value = module.terraform-seqera-aws.database_url
}
output "redis_url" {
value = module.terraform-seqera-aws.redis_url
}
output "seqera_irsa_role_name" {
value = module.terraform-seqera-aws.seqera_irsa_role_name
}
module "terraform-seqera-aws" {
source = "github.com/seqeralabs/terraform-seqera-aws"
region = "eu-west-2"
## VPC
vpc_name = "seqera-vpc"
## EC2 Instance
create_ec2_instance = true
create_ec2_instance_local_key_pair = true
create_ec2_public_instance = true
default_tags = {
Environment = "development"
ManagedBy = "Terraform"
Product = "Seqera"
CreatedBy = "DevOps"
}
}
output "database_url" {
value = module.terraform-seqera-aws.database_url
}
output "redis_url" {
value = module.terraform-seqera-aws.redis_url
}
output "ec2_instance_public_dns_name" {
value = module.terraform-seqera-aws.ec2_instance_public_dns_name
}
Note: To connect to the EC2 instance use the following syntax ssh ec2-user@<EC2 Instance Public DNS Name>
module "terraform-seqera-aws" {
source = "github.com/seqeralabs/terraform-seqera-aws"
region = "eu-west-2"
## VPC
vpc_name = "seqera-vpc"
## EC2 Instance
create_ec2_instance = true
ec2_instance_key_name = "my-key-pair"
create_ec2_public_instance = true
default_tags = {
Environment = "development"
ManagedBy = "Terraform"
Product = "Seqera"
CreatedBy = "DevOps"
}
}
output "database_url" {
value = module.terraform-seqera-aws.database_url
}
output "redis_url" {
value = module.terraform-seqera-aws.redis_url
}
output "ec2_instance_public_dns_name" {
value = module.terraform-seqera-aws.ec2_instance_public_dns_name
}
module "terraform-seqera-aws" {
source = "github.com/seqeralabs/terraform-seqera-aws"
region = "eu-west-2"
## VPC
vpc_name = "seqera-vpc"
## EC2 Instance
create_ec2_instance = true
enable_ec2_instance_session_manager_access = true
default_tags = {
Environment = "development"
ManagedBy = "Terraform"
Product = "Seqera"
CreatedBy = "DevOps"
}
}
output "database_url" {
value = module.terraform-seqera-aws.database_url
}
output "redis_url" {
value = module.terraform-seqera-aws.redis_url
}
output "ec2_instance_id" {
value = module.terraform-seqera-aws.ec2_instance_id
}
Note: To connect to the private EC2 instance, you will need to use the aws ssm
plugin. the syntax is aws ssm start-session --target <EC2 Instance ID>
module "terraform-seqera-aws" {
source = "github.com/seqeralabs/terraform-seqera-aws"
region = "eu-west-2"
## VPC
vpc_name = "seqera-vpc"
## EC2 Instance
create_ec2_instance = true
enable_ec2_instance_session_manager_access = true
create_ec2_public_instance = true
ec2_instance_security_group_ingress_rules_names = ["http-80-tcp", "https-443-tcp"]
default_tags = {
Environment = "development"
ManagedBy = "Terraform"
Product = "Seqera"
CreatedBy = "DevOps"
}
}
output "database_url" {
value = module.terraform-seqera-aws.database_url
}
output "redis_url" {
value = module.terraform-seqera-aws.redis_url
}
Note: To connect to the private EC2 instance, you will need to use the aws ssm`` plugin. the syntax is
aws ssm start-session --target `
- Clone this repository to your local machine.
- Navigate to the project directory.
- Initialize the Terraform configuration by running the following command:
terraform init
- Review the variables in the variables.tf file and update them as per your requirements.
- Run the Terraform plan command to see the execution plan:
terraform plan
If the plan looks good, apply the changes by running the following command:
terraform apply
-
Confirm the changes by typing yes when prompted. Wait for Terraform to provision the infrastructure resources.
-
Once the deployment is complete, you will see the output values that provide information about the provisioned resources.
The following outputs will be displayed after successful deployment:
To destroy the provisioned infrastructure and clean up resources, run the following command:
terraform destroy
Confirm the action by typing yes when prompted.
This Terraform code is licensed under the Apache License