Skip to content

Terraform configuration sample to create AWS 3-Tier Infrastructure for deploying Microservices using ECS & RDS/Aurora PostgreSQL

License

Notifications You must be signed in to change notification settings

dmamulashvili/terraform-aws-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-microservices

Terraform configuration sample to create AWS 3-Tier Infrastructure for deploying Microservices using ECS & RDS/Aurora PostgreSQL

Install AWS CLI

Configure access_key & secret_key using aws profile

aws configure --profile myprofile

or use access_key & secret_key variables.

variables.tf

variable "region" {
  type = string
}

variable "app_name" {
  type = string
}

# Route 53 Hosted Zone
variable "domain_name" {
  type = string
}

# ALB https
variable "certificate_arn" {
  type = string
}

variable "env_name" {
  type = string
  validation {
    condition     = var.env_name == "dev" || var.env_name == "stage" || var.env_name == "prod"
    error_message = "The env_name value must be dev, stage or prod."
  }
}

variable "db_master_username" {
  type = string
}

#variable "access_key" {
#  type = string
#}
#
#variable "secret_key" {
#  type = string
#}

main.tf

provider "aws" {
  region     = var.region
#  access_key = var.access_key
#  secret_key = var.secret_key
  profile = ""
}

Terraform backend is disabled. view versions.tf

https://www.terraform.io/language/settings/backends/configuration

// Terraform Cloud
terraform {
  cloud {
    organization = ""

    workspaces {
      name = ""
    }
  }
  required_providers {
    aws = {
      source = "hashicorp/aws"
    }
  }
}

// AWS S3
terraform {
  backend "s3" {
    bucket  = ""
    key     = ""
    region  = ""
    profile = ""
#    access_key = ""
#    secret_key = ""
  }
  required_providers {
    aws = {
      source = "hashicorp/aws"
    }
  }
}

Initialize Terraform

cd src
terraform init

Plan & Apply

terraform plan
terraform apply

Destroy

terraform destroy

About

Terraform configuration sample to create AWS 3-Tier Infrastructure for deploying Microservices using ECS & RDS/Aurora PostgreSQL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages