Skip to content

Instantly share code, notes, and snippets.

View anilchalissery's full-sized avatar

anilchalissery anilchalissery

  • Innovation Incubator ltd
  • thrissur
View GitHub Profile
locals {
# Automatically load account-level variables
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
aws_profile = local.account_vars.locals.aws_profile_name
}
terraform {
extra_arguments "aws_profile" {
commands = [
@anilchalissery
anilchalissery / cluster.yaml
Created October 20, 2022 13:04
To create eks cluster
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: dev
region: us-west-1
version: "1.23"
#availabilityZones: ["us-west-1a", "us-west-1b"]
output "s3_id" {
value = aws_s3_bucket.s3-bucket.id
description = "The id of S3"
}
output "s3_arn" {
value = aws_s3_bucket.s3-bucket.arn
description = "The id of S3"
}
variable "name" {
type = string
description = "name of s3 bucket"
}
resource "aws_s3_bucket" "s3-bucket" {
bucket = "${var.name}"
}
module "example-prod-backend-service" {
source = "../../multiport-ecs"
environment = "example-prod"
accountid = "222222222222"
region = "us-east-1"
name = "backend"
role = "arn:aws:iam::222222222222:role/ecsTaskExecutionRole"
target_group_name1 = "backend"
target_group_protocol1 = "HTTP"
target_group_name2 = "socket"
// ecr, task def, and services
resource "aws_ecr_repository" "ecr" {
name = "${var.environment}-${var.name}"
}
resource "aws_ecr_lifecycle_policy" "ecr_policy" {
repository = aws_ecr_repository.ecr.name
policy = <<EOF
provider "aws"{
profile = "profilename"
region = "us-east-1"
}
module "prod"{
source = "./env/prod"
}
@anilchalissery
anilchalissery / main.tf
Created May 5, 2022 09:19
env/prod/main.tf
##S3-Cloudfront
module "sampleapp-prod-frontend-s3cloud" {
source = "../../s3-cloudfront"
environment = "sampleweb-prod"
name = "frontend"
root_object = "index.html"
acm = "arn:aws:acm:us-east-1:123456789101:certificate/4cb08723-6052-4853-8d1f-5674ac80d092"
domain = "app.example.com"
}