File tree Expand file tree Collapse file tree 8 files changed +57
-15
lines changed
modules/ecs-instance-profile Expand file tree Collapse file tree 8 files changed +57
-15
lines changed Original file line number Diff line number Diff line change 1
1
repos :
2
2
- repo : git://github.com/antonbabenko/pre-commit-terraform
3
- rev : v1.27 .0
3
+ rev : v1.31 .0
4
4
hooks :
5
5
- id : terraform_fmt
6
6
- id : terraform_docs
7
7
- repo : git://github.com/pre-commit/pre-commit-hooks
8
- rev : v2.5 .0
8
+ rev : v3.1 .0
9
9
hooks :
10
10
- id : check-merge-conflict
Original file line number Diff line number Diff line change @@ -45,20 +45,31 @@ module "ecs" {
45
45
* [ Complete ECS] ( https://github.com/terraform-aws-modules/terraform-aws-ecs/tree/master/examples/complete-ecs )
46
46
47
47
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
48
+ ## Requirements
49
+
50
+ No requirements.
51
+
52
+ ## Providers
53
+
54
+ | Name | Version |
55
+ | ------| ---------|
56
+ | aws | n/a |
57
+
48
58
## Inputs
49
59
50
60
| Name | Description | Type | Default | Required |
51
- | ------| -------------| :----:| :-----:| :-----:|
52
- | create\_ ecs | Controls if ECS should be created | string | ` "true" ` | no |
53
- | name | Name to be used on all the resources as identifier, also the name of the ECS cluster | string | n/a | yes |
54
- | tags | A map of tags to add to ECS Cluster | map | ` <map> ` | no |
61
+ | ------| -------------| ------| ---------| :--------:|
62
+ | container\_ insights | Controls if ECS Cluster has container insights enabled | ` bool ` | ` false ` | no |
63
+ | create\_ ecs | Controls if ECS should be created | ` bool ` | ` true ` | no |
64
+ | name | Name to be used on all the resources as identifier, also the name of the ECS cluster | ` string ` | n/a | yes |
65
+ | tags | A map of tags to add to ECS Cluster | ` map(string) ` | ` {} ` | no |
55
66
56
67
## Outputs
57
68
58
69
| Name | Description |
59
70
| ------| -------------|
60
- | this\_ ecs\_ cluster\_ arn | |
61
- | this\_ ecs\_ cluster\_ id | |
71
+ | this\_ ecs\_ cluster\_ arn | n/a |
72
+ | this\_ ecs\_ cluster\_ id | n/a |
62
73
| this\_ ecs\_ cluster\_ name | The name of the ECS cluster |
63
74
64
75
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Original file line number Diff line number Diff line change @@ -39,5 +39,23 @@ Note that this example may create resources which can cost money (AWS EC2 instan
39
39
Current version creates an high-available VPC with instances that are attached to ECS. ECS tasks can be run on these instances but they are not exposed to anything.
40
40
41
41
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
42
+ ## Requirements
43
+
44
+ No requirements.
45
+
46
+ ## Providers
47
+
48
+ | Name | Version |
49
+ | ------| ---------|
50
+ | aws | n/a |
51
+ | template | n/a |
52
+
53
+ ## Inputs
54
+
55
+ No input.
56
+
57
+ ## Outputs
58
+
59
+ No output.
42
60
43
61
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Original file line number Diff line number Diff line change @@ -32,8 +32,9 @@ module "vpc" {
32
32
33
33
# ----- ECS --------
34
34
module "ecs" {
35
- source = " ../../"
36
- name = local. name
35
+ source = " ../../"
36
+ name = local. name
37
+ container_insights = true
37
38
}
38
39
39
40
module "ec2-profile" {
Original file line number Diff line number Diff line change 27
27
}
28
28
29
29
resource "aws_ecs_service" "hello_world" {
30
- name = " hello_world"
31
- cluster = var. cluster_id
30
+ name = " hello_world"
31
+ cluster = var. cluster_id
32
32
task_definition = aws_ecs_task_definition. hello_world . arn
33
33
34
34
desired_count = 1
35
35
36
- deployment_maximum_percent = 100
36
+ deployment_maximum_percent = 100
37
37
deployment_minimum_healthy_percent = 0
38
38
}
Original file line number Diff line number Diff line change @@ -2,5 +2,11 @@ resource "aws_ecs_cluster" "this" {
2
2
count = var. create_ecs ? 1 : 0
3
3
4
4
name = var. name
5
+
6
+ setting {
7
+ name = " containerInsights"
8
+ value = var. container_insights ? " enabled" : " disabled"
9
+ }
10
+
5
11
tags = var. tags
6
12
}
Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ resource "aws_iam_instance_profile" "this" {
24
24
}
25
25
26
26
resource "aws_iam_role_policy_attachment" "ecs_ec2_role" {
27
- role = aws_iam_role. this . id
27
+ role = aws_iam_role. this . id
28
28
policy_arn = " arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
29
29
}
30
30
31
31
resource "aws_iam_role_policy_attachment" "ecs_ec2_cloudwatch_role" {
32
- role = aws_iam_role. this . id
32
+ role = aws_iam_role. this . id
33
33
policy_arn = " arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"
34
34
}
Original file line number Diff line number Diff line change @@ -14,3 +14,9 @@ variable "tags" {
14
14
type = map (string )
15
15
default = {}
16
16
}
17
+
18
+ variable "container_insights" {
19
+ description = " Controls if ECS Cluster has container insights enabled"
20
+ type = bool
21
+ default = false
22
+ }
You can’t perform that action at this time.
0 commit comments