infra: add main Terraform configuration and remove IAM JSON files

This commit is contained in:
ikechukwu Elizabeth
2026-04-26 13:58:48 +01:00
parent 26f836da7b
commit e653650453
5 changed files with 62 additions and 51 deletions
+1 -1
View File
@@ -145,4 +145,4 @@ postman/
terraform.tfvars
*.tfstate
*.tfstate.backup
*.tfplan
tfplan
-29
View File
@@ -1,29 +0,0 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ECRAuthentication",
"Effect": "Allow",
"Action": "ecr:GetAuthorizationToken",
"Resource": "*"
},
{
"Sid": "ECRImagePush",
"Effect": "Allow",
"Action": [
"ecr:BatchCheckLayerAvailability",
"ecr:BatchGetImage",
"ecr:CompleteLayerUpload",
"ecr:DescribeRepositories",
"ecr:GetDownloadUrlForLayer",
"ecr:InitiateLayerUpload",
"ecr:PutImage",
"ecr:UploadLayerPart"
],
"Resource": [
"arn:aws:ecr:us-east-1:424522917561:repository/task-backend",
"arn:aws:ecr:us-east-1:424522917561:repository/task-frontend"
]
}
]
}
-21
View File
@@ -1,21 +0,0 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "GitHubActionsOIDC",
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::424522917561:oidc-provider/token.actions.githubusercontent.com"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
},
"StringLike": {
"token.actions.githubusercontent.com:sub": "repo:elizabeth-ikechukwu/scalable-task-platform:*"
}
}
}
]
}
+22
View File
@@ -0,0 +1,22 @@
terraform {
required_version = ">= 1.10.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
backend "s3" {
bucket = "scalable-task-platform-tfstate"
key = "main/terraform.tfstate"
region = "us-east-1"
use_lockfile = true
encrypt = true
}
}
provider "aws" {
region = var.aws_region
}
+39
View File
@@ -0,0 +1,39 @@
variable "aws_region" {
description = "AWS region for all resources"
type = string
}
variable "aws_account_id" {
description = "AWS account ID — set in terraform.tfvars, never hardcoded"
type = string
}
variable "project_name" {
description = "Project name used for naming and tagging all resources"
type = string
default = "scalable-task-platform"
}
variable "environment" {
description = "Deployment environment"
type = string
default = "production"
}
variable "vpc_cidr" {
description = "CIDR block for the VPC"
type = string
default = "10.0.0.0/16"
}
variable "public_subnet_cidr" {
description = "CIDR block for the public subnet"
type = string
default = "10.0.1.0/24"
}
variable "private_subnet_cidr" {
description = "CIDR block for the private subnet"
type = string
default = "10.0.2.0/24"
}