-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathmain.tf
More file actions
122 lines (105 loc) · 2.93 KB
/
main.tf
File metadata and controls
122 lines (105 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
provider "aws" {
region = "us-east-1"
skip_credentials_validation = true
skip_requesting_account_id = true
access_key = "mock_access_key"
secret_key = "mock_secret_key"
}
resource "aws_cloudwatch_log_group" "app_logs" {
name = "my_app_logs"
}
resource "aws_s3_bucket" "screenshots_dev" {
bucket = "my_screenshots_bucket_dev"
}
resource "aws_s3_bucket" "screenshots_stage" {
bucket = "my_screenshots_bucket_stage"
}
resource "aws_s3_bucket" "screenshots_qa" {
bucket = "my_screenshots_bucket_qa"
}
resource "aws_s3_bucket_lifecycle_configuration" "screenshots_qa_lifecycle" {
bucket = aws_s3_bucket.screenshots_qa.id
rule {
id = "intelligent_tiering_rule"
status = "Enabled"
transition {
days = 30
storage_class = "INTELLIGENT_TIERING"
}
filter {
object_size_greater_than = 131072 # 128KB in bytes
}
}
}
resource "aws_s3_bucket" "screenshots_prod" {
bucket = "my_screenshots_bucket_prod"
}
resource "aws_db_instance" "my_db" {
identifier = "mysql57-extended"
engine = "mysql"
engine_version = "5.7.44"
instance_class = "c5.2xlarge"
allocated_storage = 20
username = "admin"
password = "yourpassword"
db_name = "exampledb"
publicly_accessible = false
skip_final_snapshot = true
deletion_protection = false
tags = {
Name = "my-db"
}
}
module "eks" {
source = "terraform-aws-modules/eks/aws"
cluster_name = "my-eks-extended"
cluster_version = "1.24"
subnet_ids = ["subnet-abc123", "subnet-def456"]
vpc_id = "vpc-123456"
node_groups = {
default = {
desired_capacity = 100
max_capacity = 300
min_capacity = 50
instance_types = ["c5.2xlarge"]
}
}
}
resource "aws_ecs_task_definition" "my_task" {
family = "my-task"
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
cpu = "1024" # 1 vCPU
memory = "2048" # 2 GB
execution_role_arn = "aws_iam_role.ecs_task_execution_role.arn"
container_definitions = jsonencode([
{
name = "task-container"
image = "public.ecr.aws/nginx:latest"
essential = true
portMappings = [
{
containerPort = 80
hostPort = 80
protocol = "tcp"
}
]
}
])
}
provider "azurerm" {
skip_provider_registration = true
features {}
}
resource "azurerm_log_analytics_workspace" "azure_app1_logs" {
name = "example-logs-1"
location = "East US"
resource_group_name = "example-rg"
sku = "PerGB2018"
}
resource "azurerm_log_analytics_workspace" "azure_app2_logs" {
name = "example-logs-2"
location = "East US"
resource_group_name = "example-rg"
sku = "PerGB2018"
}