tf-starter 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +421 -0
  3. package/bin/tf-starter.js +88 -0
  4. package/package.json +43 -0
  5. package/scripts/postinstall.js +105 -0
  6. package/setup.py +32 -0
  7. package/tf_starter/__init__.py +3 -0
  8. package/tf_starter/__main__.py +6 -0
  9. package/tf_starter/cli.py +379 -0
  10. package/tf_starter/generator.py +171 -0
  11. package/tf_starter/template_engine.py +80 -0
  12. package/tf_starter/templates/aws/environments/backend.tf.j2 +16 -0
  13. package/tf_starter/templates/aws/environments/main.tf.j2 +85 -0
  14. package/tf_starter/templates/aws/environments/terraform.tfvars.j2 +52 -0
  15. package/tf_starter/templates/aws/environments/variables.tf.j2 +127 -0
  16. package/tf_starter/templates/aws/github/terraform.yml.j2 +133 -0
  17. package/tf_starter/templates/aws/misc/Makefile.j2 +60 -0
  18. package/tf_starter/templates/aws/misc/README.md.j2 +445 -0
  19. package/tf_starter/templates/aws/misc/init.sh.j2 +110 -0
  20. package/tf_starter/templates/aws/misc/pre-commit-config.yaml.j2 +34 -0
  21. package/tf_starter/templates/aws/modules/apigateway/main.tf.j2 +224 -0
  22. package/tf_starter/templates/aws/modules/apigateway/outputs.tf.j2 +28 -0
  23. package/tf_starter/templates/aws/modules/apigateway/variables.tf.j2 +69 -0
  24. package/tf_starter/templates/aws/modules/compute/main.tf.j2 +245 -0
  25. package/tf_starter/templates/aws/modules/compute/outputs.tf.j2 +38 -0
  26. package/tf_starter/templates/aws/modules/compute/variables.tf.j2 +68 -0
  27. package/tf_starter/templates/aws/modules/database/main.tf.j2 +122 -0
  28. package/tf_starter/templates/aws/modules/database/outputs.tf.j2 +33 -0
  29. package/tf_starter/templates/aws/modules/database/variables.tf.j2 +63 -0
  30. package/tf_starter/templates/aws/modules/kubernetes/main.tf.j2 +167 -0
  31. package/tf_starter/templates/aws/modules/kubernetes/outputs.tf.j2 +33 -0
  32. package/tf_starter/templates/aws/modules/kubernetes/variables.tf.j2 +64 -0
  33. package/tf_starter/templates/aws/modules/lambda/main.tf.j2 +215 -0
  34. package/tf_starter/templates/aws/modules/lambda/outputs.tf.j2 +38 -0
  35. package/tf_starter/templates/aws/modules/lambda/variables.tf.j2 +88 -0
  36. package/tf_starter/templates/aws/modules/messaging/main.tf.j2 +85 -0
  37. package/tf_starter/templates/aws/modules/messaging/outputs.tf.j2 +28 -0
  38. package/tf_starter/templates/aws/modules/messaging/variables.tf.j2 +41 -0
  39. package/tf_starter/templates/aws/modules/monitoring/main.tf.j2 +155 -0
  40. package/tf_starter/templates/aws/modules/monitoring/outputs.tf.j2 +23 -0
  41. package/tf_starter/templates/aws/modules/monitoring/variables.tf.j2 +39 -0
  42. package/tf_starter/templates/aws/modules/network/main.tf.j2 +147 -0
  43. package/tf_starter/templates/aws/modules/network/outputs.tf.j2 +33 -0
  44. package/tf_starter/templates/aws/modules/network/variables.tf.j2 +52 -0
  45. package/tf_starter/templates/aws/modules/storage/main.tf.j2 +88 -0
  46. package/tf_starter/templates/aws/modules/storage/outputs.tf.j2 +23 -0
  47. package/tf_starter/templates/aws/modules/storage/variables.tf.j2 +25 -0
  48. package/tf_starter/templates/aws/root/backend.tf.j2 +19 -0
  49. package/tf_starter/templates/aws/root/main.tf.j2 +219 -0
  50. package/tf_starter/templates/aws/root/outputs.tf.j2 +134 -0
  51. package/tf_starter/templates/aws/root/providers.tf.j2 +24 -0
  52. package/tf_starter/templates/aws/root/variables.tf.j2 +300 -0
  53. package/tf_starter/templates/aws/root/versions.tf.j2 +26 -0
  54. package/tf_starter/templates/azure/environments/backend.tf.j2 +11 -0
  55. package/tf_starter/templates/azure/environments/main.tf.j2 +57 -0
  56. package/tf_starter/templates/azure/environments/terraform.tfvars.j2 +14 -0
  57. package/tf_starter/templates/azure/environments/variables.tf.j2 +30 -0
  58. package/tf_starter/templates/azure/github/terraform.yml.j2 +133 -0
  59. package/tf_starter/templates/azure/misc/Makefile.j2 +60 -0
  60. package/tf_starter/templates/azure/misc/README.md.j2 +426 -0
  61. package/tf_starter/templates/azure/misc/init.sh.j2 +110 -0
  62. package/tf_starter/templates/azure/misc/pre-commit-config.yaml.j2 +34 -0
  63. package/tf_starter/templates/azure/modules/apigateway/main.tf.j2 +125 -0
  64. package/tf_starter/templates/azure/modules/apigateway/outputs.tf.j2 +18 -0
  65. package/tf_starter/templates/azure/modules/apigateway/variables.tf.j2 +54 -0
  66. package/tf_starter/templates/azure/modules/compute/main.tf.j2 +114 -0
  67. package/tf_starter/templates/azure/modules/compute/outputs.tf.j2 +9 -0
  68. package/tf_starter/templates/azure/modules/compute/variables.tf.j2 +23 -0
  69. package/tf_starter/templates/azure/modules/database/main.tf.j2 +56 -0
  70. package/tf_starter/templates/azure/modules/database/outputs.tf.j2 +13 -0
  71. package/tf_starter/templates/azure/modules/database/variables.tf.j2 +38 -0
  72. package/tf_starter/templates/azure/modules/kubernetes/main.tf.j2 +50 -0
  73. package/tf_starter/templates/azure/modules/kubernetes/outputs.tf.j2 +19 -0
  74. package/tf_starter/templates/azure/modules/kubernetes/variables.tf.j2 +37 -0
  75. package/tf_starter/templates/azure/modules/lambda/main.tf.j2 +98 -0
  76. package/tf_starter/templates/azure/modules/lambda/outputs.tf.j2 +23 -0
  77. package/tf_starter/templates/azure/modules/lambda/variables.tf.j2 +53 -0
  78. package/tf_starter/templates/azure/modules/messaging/main.tf.j2 +29 -0
  79. package/tf_starter/templates/azure/modules/messaging/outputs.tf.j2 +14 -0
  80. package/tf_starter/templates/azure/modules/messaging/variables.tf.j2 +11 -0
  81. package/tf_starter/templates/azure/modules/monitoring/main.tf.j2 +31 -0
  82. package/tf_starter/templates/azure/modules/monitoring/outputs.tf.j2 +9 -0
  83. package/tf_starter/templates/azure/modules/monitoring/variables.tf.j2 +16 -0
  84. package/tf_starter/templates/azure/modules/network/main.tf.j2 +89 -0
  85. package/tf_starter/templates/azure/modules/network/outputs.tf.j2 +25 -0
  86. package/tf_starter/templates/azure/modules/network/variables.tf.j2 +25 -0
  87. package/tf_starter/templates/azure/modules/storage/main.tf.j2 +41 -0
  88. package/tf_starter/templates/azure/modules/storage/outputs.tf.j2 +17 -0
  89. package/tf_starter/templates/azure/modules/storage/variables.tf.j2 +16 -0
  90. package/tf_starter/templates/azure/root/backend.tf.j2 +11 -0
  91. package/tf_starter/templates/azure/root/main.tf.j2 +181 -0
  92. package/tf_starter/templates/azure/root/outputs.tf.j2 +45 -0
  93. package/tf_starter/templates/azure/root/providers.tf.j2 +18 -0
  94. package/tf_starter/templates/azure/root/variables.tf.j2 +114 -0
  95. package/tf_starter/templates/azure/root/versions.tf.j2 +16 -0
  96. package/tf_starter/templates/gcp/environments/backend.tf.j2 +9 -0
  97. package/tf_starter/templates/gcp/environments/main.tf.j2 +58 -0
  98. package/tf_starter/templates/gcp/environments/terraform.tfvars.j2 +12 -0
  99. package/tf_starter/templates/gcp/environments/variables.tf.j2 +21 -0
  100. package/tf_starter/templates/gcp/github/terraform.yml.j2 +133 -0
  101. package/tf_starter/templates/gcp/misc/Makefile.j2 +60 -0
  102. package/tf_starter/templates/gcp/misc/README.md.j2 +426 -0
  103. package/tf_starter/templates/gcp/misc/init.sh.j2 +110 -0
  104. package/tf_starter/templates/gcp/misc/pre-commit-config.yaml.j2 +34 -0
  105. package/tf_starter/templates/gcp/modules/apigateway/main.tf.j2 +67 -0
  106. package/tf_starter/templates/gcp/modules/apigateway/outputs.tf.j2 +18 -0
  107. package/tf_starter/templates/gcp/modules/apigateway/variables.tf.j2 +34 -0
  108. package/tf_starter/templates/gcp/modules/compute/main.tf.j2 +138 -0
  109. package/tf_starter/templates/gcp/modules/compute/outputs.tf.j2 +13 -0
  110. package/tf_starter/templates/gcp/modules/compute/variables.tf.j2 +33 -0
  111. package/tf_starter/templates/gcp/modules/database/main.tf.j2 +62 -0
  112. package/tf_starter/templates/gcp/modules/database/outputs.tf.j2 +13 -0
  113. package/tf_starter/templates/gcp/modules/database/variables.tf.j2 +29 -0
  114. package/tf_starter/templates/gcp/modules/kubernetes/main.tf.j2 +75 -0
  115. package/tf_starter/templates/gcp/modules/kubernetes/outputs.tf.j2 +14 -0
  116. package/tf_starter/templates/gcp/modules/kubernetes/variables.tf.j2 +38 -0
  117. package/tf_starter/templates/gcp/modules/lambda/main.tf.j2 +122 -0
  118. package/tf_starter/templates/gcp/modules/lambda/outputs.tf.j2 +18 -0
  119. package/tf_starter/templates/gcp/modules/lambda/variables.tf.j2 +77 -0
  120. package/tf_starter/templates/gcp/modules/messaging/main.tf.j2 +44 -0
  121. package/tf_starter/templates/gcp/modules/messaging/outputs.tf.j2 +13 -0
  122. package/tf_starter/templates/gcp/modules/messaging/variables.tf.j2 +20 -0
  123. package/tf_starter/templates/gcp/modules/monitoring/main.tf.j2 +44 -0
  124. package/tf_starter/templates/gcp/modules/monitoring/outputs.tf.j2 +9 -0
  125. package/tf_starter/templates/gcp/modules/monitoring/variables.tf.j2 +13 -0
  126. package/tf_starter/templates/gcp/modules/network/main.tf.j2 +103 -0
  127. package/tf_starter/templates/gcp/modules/network/outputs.tf.j2 +21 -0
  128. package/tf_starter/templates/gcp/modules/network/variables.tf.j2 +22 -0
  129. package/tf_starter/templates/gcp/modules/storage/main.tf.j2 +47 -0
  130. package/tf_starter/templates/gcp/modules/storage/outputs.tf.j2 +13 -0
  131. package/tf_starter/templates/gcp/modules/storage/variables.tf.j2 +16 -0
  132. package/tf_starter/templates/gcp/root/backend.tf.j2 +12 -0
  133. package/tf_starter/templates/gcp/root/main.tf.j2 +210 -0
  134. package/tf_starter/templates/gcp/root/outputs.tf.j2 +61 -0
  135. package/tf_starter/templates/gcp/root/providers.tf.j2 +18 -0
  136. package/tf_starter/templates/gcp/root/variables.tf.j2 +140 -0
  137. package/tf_starter/templates/gcp/root/versions.tf.j2 +23 -0
@@ -0,0 +1,52 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # NETWORK MODULE — Variables
3
+ # ---------------------------------------------------------------------------------------------------------------------
4
+
5
+ variable "project_name" {
6
+ description = "Name of the project"
7
+ type = string
8
+ }
9
+
10
+ variable "environment" {
11
+ description = "Deployment environment"
12
+ type = string
13
+ }
14
+
15
+ variable "region" {
16
+ description = "AWS region"
17
+ type = string
18
+ }
19
+
20
+ variable "vpc_cidr" {
21
+ description = "CIDR block for the VPC"
22
+ type = string
23
+ default = "10.0.0.0/16"
24
+
25
+ validation {
26
+ condition = can(cidrhost(var.vpc_cidr, 0))
27
+ error_message = "Must be a valid CIDR block."
28
+ }
29
+ }
30
+
31
+ variable "public_subnet_cidrs" {
32
+ description = "CIDR blocks for public subnets"
33
+ type = list(string)
34
+ default = ["10.0.1.0/24", "10.0.2.0/24"]
35
+ }
36
+
37
+ variable "private_subnet_cidrs" {
38
+ description = "CIDR blocks for private subnets"
39
+ type = list(string)
40
+ default = ["10.0.10.0/24", "10.0.11.0/24"]
41
+ }
42
+
43
+ variable "availability_zones" {
44
+ description = "Availability zones to deploy into"
45
+ type = list(string)
46
+ }
47
+
48
+ variable "tags" {
49
+ description = "Common resource tags"
50
+ type = map(string)
51
+ default = {}
52
+ }
@@ -0,0 +1,88 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # STORAGE MODULE — Amazon S3
3
+ # Project: {{ project_name }}
4
+ # Generated by tf-starter
5
+ # ---------------------------------------------------------------------------------------------------------------------
6
+
7
+ locals {
8
+ name_prefix = "${var.project_name}-${var.environment}"
9
+ }
10
+
11
+ # ---------------------------------------------------------------------------------------------------------------------
12
+ # S3 BUCKET
13
+ # ---------------------------------------------------------------------------------------------------------------------
14
+
15
+ resource "aws_s3_bucket" "main" {
16
+ bucket = "${local.name_prefix}-storage"
17
+
18
+ tags = merge(var.tags, {
19
+ Name = "${local.name_prefix}-storage"
20
+ })
21
+ }
22
+
23
+ # ---------------------------------------------------------------------------------------------------------------------
24
+ # VERSIONING
25
+ # ---------------------------------------------------------------------------------------------------------------------
26
+
27
+ resource "aws_s3_bucket_versioning" "main" {
28
+ bucket = aws_s3_bucket.main.id
29
+
30
+ versioning_configuration {
31
+ status = var.enable_versioning ? "Enabled" : "Suspended"
32
+ }
33
+ }
34
+
35
+ # ---------------------------------------------------------------------------------------------------------------------
36
+ # ENCRYPTION
37
+ # ---------------------------------------------------------------------------------------------------------------------
38
+
39
+ resource "aws_s3_bucket_server_side_encryption_configuration" "main" {
40
+ bucket = aws_s3_bucket.main.id
41
+
42
+ rule {
43
+ apply_server_side_encryption_by_default {
44
+ sse_algorithm = "AES256"
45
+ }
46
+ bucket_key_enabled = true
47
+ }
48
+ }
49
+
50
+ # ---------------------------------------------------------------------------------------------------------------------
51
+ # BLOCK PUBLIC ACCESS
52
+ # ---------------------------------------------------------------------------------------------------------------------
53
+
54
+ resource "aws_s3_bucket_public_access_block" "main" {
55
+ bucket = aws_s3_bucket.main.id
56
+
57
+ block_public_acls = true
58
+ block_public_policy = true
59
+ ignore_public_acls = true
60
+ restrict_public_buckets = true
61
+ }
62
+
63
+ # ---------------------------------------------------------------------------------------------------------------------
64
+ # LIFECYCLE RULES
65
+ # ---------------------------------------------------------------------------------------------------------------------
66
+
67
+ resource "aws_s3_bucket_lifecycle_configuration" "main" {
68
+ bucket = aws_s3_bucket.main.id
69
+
70
+ rule {
71
+ id = "transition-to-ia"
72
+ status = "Enabled"
73
+
74
+ transition {
75
+ days = 90
76
+ storage_class = "STANDARD_IA"
77
+ }
78
+
79
+ transition {
80
+ days = 180
81
+ storage_class = "GLACIER"
82
+ }
83
+
84
+ noncurrent_version_expiration {
85
+ noncurrent_days = 90
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,23 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # STORAGE MODULE — Outputs
3
+ # ---------------------------------------------------------------------------------------------------------------------
4
+
5
+ output "bucket_id" {
6
+ description = "ID of the S3 bucket"
7
+ value = aws_s3_bucket.main.id
8
+ }
9
+
10
+ output "bucket_arn" {
11
+ description = "ARN of the S3 bucket"
12
+ value = aws_s3_bucket.main.arn
13
+ }
14
+
15
+ output "bucket_domain_name" {
16
+ description = "Domain name of the S3 bucket"
17
+ value = aws_s3_bucket.main.bucket_domain_name
18
+ }
19
+
20
+ output "bucket_regional_domain_name" {
21
+ description = "Regional domain name of the S3 bucket"
22
+ value = aws_s3_bucket.main.bucket_regional_domain_name
23
+ }
@@ -0,0 +1,25 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # STORAGE MODULE — Variables
3
+ # ---------------------------------------------------------------------------------------------------------------------
4
+
5
+ variable "project_name" {
6
+ description = "Name of the project"
7
+ type = string
8
+ }
9
+
10
+ variable "environment" {
11
+ description = "Deployment environment"
12
+ type = string
13
+ }
14
+
15
+ variable "enable_versioning" {
16
+ description = "Enable S3 bucket versioning"
17
+ type = bool
18
+ default = true
19
+ }
20
+
21
+ variable "tags" {
22
+ description = "Common resource tags"
23
+ type = map(string)
24
+ default = {}
25
+ }
@@ -0,0 +1,19 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # REMOTE BACKEND CONFIGURATION (S3 + DynamoDB)
3
+ # Project: {{ project_name }}
4
+ # Generated by tf-starter
5
+ # ---------------------------------------------------------------------------------------------------------------------
6
+
7
+ terraform {
8
+ backend "s3" {
9
+ ### MUST EDIT THIS ###
10
+ bucket = "{{ project_name }}-terraform-state"
11
+ key = "{{ project_name }}/terraform.tfstate"
12
+ region = "{{ region }}"
13
+ encrypt = true
14
+ dynamodb_table = "{{ project_name }}-terraform-lock"
15
+
16
+ # Uncomment to use a specific AWS profile:
17
+ # profile = "your-aws-profile"
18
+ }
19
+ }
@@ -0,0 +1,219 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # ROOT MAIN CONFIGURATION
3
+ # Project: {{ project_name }}
4
+ # Provider: {{ provider | upper }}
5
+ # Generated by tf-starter
6
+ # ---------------------------------------------------------------------------------------------------------------------
7
+
8
+ locals {
9
+ project_name = "{{ project_name }}"
10
+ region = var.region
11
+ environment = var.environment
12
+
13
+ common_tags = {
14
+ Project = local.project_name
15
+ Environment = local.environment
16
+ ManagedBy = "terraform"
17
+ Generator = "tf-starter"
18
+ }
19
+ }
20
+
21
+ # ---------------------------------------------------------------------------------------------------------------------
22
+ # NETWORK MODULE (always included)
23
+ # ---------------------------------------------------------------------------------------------------------------------
24
+
25
+ module "network" {
26
+ source = "./modules/network"
27
+
28
+ project_name = local.project_name
29
+ environment = local.environment
30
+ region = local.region
31
+
32
+ vpc_cidr = var.vpc_cidr
33
+ public_subnet_cidrs = var.public_subnet_cidrs
34
+ private_subnet_cidrs = var.private_subnet_cidrs
35
+ availability_zones = var.availability_zones
36
+
37
+ tags = local.common_tags
38
+ }
39
+
40
+ {% if "compute" in services %}
41
+ # ---------------------------------------------------------------------------------------------------------------------
42
+ # COMPUTE MODULE
43
+ # ---------------------------------------------------------------------------------------------------------------------
44
+
45
+ module "compute" {
46
+ source = "./modules/compute"
47
+
48
+ project_name = local.project_name
49
+ environment = local.environment
50
+
51
+ vpc_id = module.network.vpc_id
52
+ private_subnet_ids = module.network.private_subnet_ids
53
+ public_subnet_ids = module.network.public_subnet_ids
54
+
55
+ instance_type = var.instance_type
56
+ min_size = var.asg_min_size
57
+ max_size = var.asg_max_size
58
+ desired_capacity = var.asg_desired_capacity
59
+
60
+ tags = local.common_tags
61
+ }
62
+ {% endif %}
63
+
64
+ {% if "lambda" in services %}
65
+ # ---------------------------------------------------------------------------------------------------------------------
66
+ # LAMBDA MODULE
67
+ # ---------------------------------------------------------------------------------------------------------------------
68
+
69
+ module "lambda" {
70
+ source = "./modules/lambda"
71
+
72
+ project_name = local.project_name
73
+ environment = local.environment
74
+
75
+ function_name = var.lambda_function_name
76
+ runtime = var.lambda_runtime
77
+ handler = var.lambda_handler
78
+ timeout = var.lambda_timeout
79
+ memory_size = var.lambda_memory_size
80
+ environment_variables = var.lambda_environment_variables
81
+
82
+ deploy_in_vpc = var.lambda_deploy_in_vpc
83
+ vpc_id = module.network.vpc_id
84
+ private_subnet_ids = module.network.private_subnet_ids
85
+
86
+ tags = local.common_tags
87
+ }
88
+ {% endif %}
89
+
90
+ {% if "apigateway" in services %}
91
+ # ---------------------------------------------------------------------------------------------------------------------
92
+ # API GATEWAY MODULE
93
+ # ---------------------------------------------------------------------------------------------------------------------
94
+
95
+ module "apigateway" {
96
+ source = "./modules/apigateway"
97
+
98
+ project_name = local.project_name
99
+ environment = local.environment
100
+
101
+ lambda_function_name = module.lambda.function_name
102
+ lambda_invoke_arn = module.lambda.invoke_arn
103
+
104
+ endpoint_type = var.apigw_endpoint_type
105
+ authorization_type = var.apigw_authorization_type
106
+ throttle_burst_limit = var.apigw_throttle_burst_limit
107
+ throttle_rate_limit = var.apigw_throttle_rate_limit
108
+ enable_cors = var.apigw_enable_cors
109
+
110
+ tags = local.common_tags
111
+ }
112
+ {% endif %}
113
+
114
+ {% if "database" in services %}
115
+ # ---------------------------------------------------------------------------------------------------------------------
116
+ # DATABASE MODULE
117
+ # ---------------------------------------------------------------------------------------------------------------------
118
+
119
+ module "database" {
120
+ source = "./modules/database"
121
+
122
+ project_name = local.project_name
123
+ environment = local.environment
124
+
125
+ vpc_id = module.network.vpc_id
126
+ private_subnet_ids = module.network.private_subnet_ids
127
+
128
+ db_instance_class = var.db_instance_class
129
+ db_allocated_storage = var.db_allocated_storage
130
+ db_name = var.db_name
131
+ db_username = var.db_username
132
+ db_multi_az = var.environment == "prod" ? true : false
133
+
134
+ tags = local.common_tags
135
+ }
136
+ {% endif %}
137
+
138
+ {% if "kubernetes" in services %}
139
+ # ---------------------------------------------------------------------------------------------------------------------
140
+ # KUBERNETES MODULE (EKS)
141
+ # ---------------------------------------------------------------------------------------------------------------------
142
+
143
+ module "kubernetes" {
144
+ source = "./modules/kubernetes"
145
+
146
+ project_name = local.project_name
147
+ environment = local.environment
148
+
149
+ vpc_id = module.network.vpc_id
150
+ private_subnet_ids = module.network.private_subnet_ids
151
+
152
+ cluster_version = var.eks_cluster_version
153
+ node_instance_type = var.eks_node_instance_type
154
+ node_desired_size = var.eks_node_desired_size
155
+ node_min_size = var.eks_node_min_size
156
+ node_max_size = var.eks_node_max_size
157
+
158
+ tags = local.common_tags
159
+ }
160
+ {% endif %}
161
+
162
+ {% if "monitoring" in services %}
163
+ # ---------------------------------------------------------------------------------------------------------------------
164
+ # MONITORING MODULE
165
+ # ---------------------------------------------------------------------------------------------------------------------
166
+
167
+ module "monitoring" {
168
+ source = "./modules/monitoring"
169
+
170
+ project_name = local.project_name
171
+ environment = local.environment
172
+
173
+ alarm_email = var.alarm_email
174
+
175
+ {% if "compute" in services %}
176
+ asg_name = module.compute.asg_name
177
+ {% endif %}
178
+ {% if "database" in services %}
179
+ db_instance_id = module.database.db_instance_id
180
+ {% endif %}
181
+
182
+ tags = local.common_tags
183
+ }
184
+ {% endif %}
185
+
186
+ {% if "messaging" in services %}
187
+ # ---------------------------------------------------------------------------------------------------------------------
188
+ # MESSAGING MODULE (SQS)
189
+ # ---------------------------------------------------------------------------------------------------------------------
190
+
191
+ module "messaging" {
192
+ source = "./modules/messaging"
193
+
194
+ project_name = local.project_name
195
+ environment = local.environment
196
+
197
+ message_retention_seconds = var.sqs_message_retention
198
+ visibility_timeout = var.sqs_visibility_timeout
199
+
200
+ tags = local.common_tags
201
+ }
202
+ {% endif %}
203
+
204
+ {% if "storage" in services %}
205
+ # ---------------------------------------------------------------------------------------------------------------------
206
+ # STORAGE MODULE (S3)
207
+ # ---------------------------------------------------------------------------------------------------------------------
208
+
209
+ module "storage" {
210
+ source = "./modules/storage"
211
+
212
+ project_name = local.project_name
213
+ environment = local.environment
214
+
215
+ enable_versioning = var.s3_enable_versioning
216
+
217
+ tags = local.common_tags
218
+ }
219
+ {% endif %}
@@ -0,0 +1,134 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # ROOT OUTPUTS
3
+ # Project: {{ project_name }}
4
+ # Generated by tf-starter
5
+ # ---------------------------------------------------------------------------------------------------------------------
6
+
7
+ # ----- Network -----
8
+
9
+ output "vpc_id" {
10
+ description = "ID of the VPC"
11
+ value = module.network.vpc_id
12
+ }
13
+
14
+ output "public_subnet_ids" {
15
+ description = "IDs of the public subnets"
16
+ value = module.network.public_subnet_ids
17
+ }
18
+
19
+ output "private_subnet_ids" {
20
+ description = "IDs of the private subnets"
21
+ value = module.network.private_subnet_ids
22
+ }
23
+
24
+ {% if "compute" in services %}
25
+ # ----- Compute -----
26
+
27
+ output "alb_dns_name" {
28
+ description = "DNS name of the Application Load Balancer"
29
+ value = module.compute.alb_dns_name
30
+ }
31
+
32
+ output "asg_name" {
33
+ description = "Name of the Auto Scaling Group"
34
+ value = module.compute.asg_name
35
+ }
36
+ {% endif %}
37
+
38
+ {% if "lambda" in services %}
39
+ # ----- Lambda -----
40
+
41
+ output "lambda_function_name" {
42
+ description = "Name of the Lambda function"
43
+ value = module.lambda.function_name
44
+ }
45
+
46
+ output "lambda_function_arn" {
47
+ description = "ARN of the Lambda function"
48
+ value = module.lambda.function_arn
49
+ }
50
+
51
+ output "lambda_invoke_arn" {
52
+ description = "Invocation ARN of the Lambda function"
53
+ value = module.lambda.invoke_arn
54
+ }
55
+ {% endif %}
56
+
57
+ {% if "apigateway" in services %}
58
+ # ----- API Gateway -----
59
+
60
+ output "api_endpoint" {
61
+ description = "Invoke URL of the API Gateway"
62
+ value = module.apigateway.api_endpoint
63
+ }
64
+
65
+ output "api_id" {
66
+ description = "ID of the API Gateway REST API"
67
+ value = module.apigateway.api_id
68
+ }
69
+ {% endif %}
70
+
71
+ {% if "database" in services %}
72
+ # ----- Database -----
73
+
74
+ output "db_endpoint" {
75
+ description = "RDS instance endpoint"
76
+ value = module.database.db_endpoint
77
+ }
78
+
79
+ output "db_port" {
80
+ description = "RDS instance port"
81
+ value = module.database.db_port
82
+ }
83
+ {% endif %}
84
+
85
+ {% if "kubernetes" in services %}
86
+ # ----- Kubernetes (EKS) -----
87
+
88
+ output "eks_cluster_endpoint" {
89
+ description = "EKS cluster API endpoint"
90
+ value = module.kubernetes.cluster_endpoint
91
+ }
92
+
93
+ output "eks_cluster_name" {
94
+ description = "EKS cluster name"
95
+ value = module.kubernetes.cluster_name
96
+ }
97
+ {% endif %}
98
+
99
+ {% if "monitoring" in services %}
100
+ # ----- Monitoring -----
101
+
102
+ output "sns_topic_arn" {
103
+ description = "ARN of the SNS alarm topic"
104
+ value = module.monitoring.sns_topic_arn
105
+ }
106
+ {% endif %}
107
+
108
+ {% if "messaging" in services %}
109
+ # ----- Messaging -----
110
+
111
+ output "sqs_queue_url" {
112
+ description = "URL of the SQS queue"
113
+ value = module.messaging.queue_url
114
+ }
115
+
116
+ output "sqs_queue_arn" {
117
+ description = "ARN of the SQS queue"
118
+ value = module.messaging.queue_arn
119
+ }
120
+ {% endif %}
121
+
122
+ {% if "storage" in services %}
123
+ # ----- Storage -----
124
+
125
+ output "s3_bucket_id" {
126
+ description = "ID of the S3 bucket"
127
+ value = module.storage.bucket_id
128
+ }
129
+
130
+ output "s3_bucket_arn" {
131
+ description = "ARN of the S3 bucket"
132
+ value = module.storage.bucket_arn
133
+ }
134
+ {% endif %}
@@ -0,0 +1,24 @@
1
+ # ---------------------------------------------------------------------------------------------------------------------
2
+ # PROVIDER CONFIGURATION
3
+ # Project: {{ project_name }}
4
+ # Generated by tf-starter
5
+ # ---------------------------------------------------------------------------------------------------------------------
6
+
7
+ provider "aws" {
8
+ region = var.region
9
+
10
+ default_tags {
11
+ tags = {
12
+ Project = "{{ project_name }}"
13
+ ManagedBy = "terraform"
14
+ Generator = "tf-starter"
15
+ }
16
+ }
17
+
18
+ ### MUST EDIT THIS ###
19
+ # Uncomment and configure as needed:
20
+ # profile = "your-aws-profile"
21
+ # assume_role {
22
+ # role_arn = "arn:aws:iam::ACCOUNT_ID:role/TerraformRole"
23
+ # }
24
+ }