Skip to content

Commit c71bcaa

Browse files
authored
feat: Added IAM role id to outputs (#13)
1 parent 82820f3 commit c71bcaa

File tree

15 files changed

+89
-17
lines changed

15 files changed

+89
-17
lines changed

.pre-commit-config.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.31.0
3+
rev: v1.43.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
7+
- id: terraform_tflint
8+
args:
9+
- '--args=--only=terraform_deprecated_interpolation'
10+
- '--args=--only=terraform_deprecated_index'
11+
- '--args=--only=terraform_unused_declarations'
12+
- '--args=--only=terraform_comment_syntax'
13+
- '--args=--only=terraform_documented_outputs'
14+
- '--args=--only=terraform_documented_variables'
15+
- '--args=--only=terraform_typed_variables'
16+
- '--args=--only=terraform_module_pinned_source'
17+
- '--args=--only=terraform_naming_convention'
18+
- '--args=--only=terraform_required_version'
19+
- '--args=--only=terraform_required_providers'
20+
- '--args=--only=terraform_standard_module_structure'
21+
- '--args=--only=terraform_workspace_remote'
722
- repo: git://github.com/pre-commit/pre-commit-hooks
8-
rev: v3.1.0
23+
rev: v3.2.0
924
hooks:
1025
- id: check-merge-conflict

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ module "ecs" {
4747
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4848
## Requirements
4949

50-
No requirements.
50+
| Name | Version |
51+
|------|---------|
52+
| terraform | >= 0.12.6, < 0.14 |
53+
| aws | >= 2.0, < 4.0 |
5154

5255
## Providers
5356

5457
| Name | Version |
5558
|------|---------|
56-
| aws | n/a |
59+
| aws | >= 2.0, < 4.0 |
5760

5861
## Inputs
5962

@@ -68,8 +71,8 @@ No requirements.
6871

6972
| Name | Description |
7073
|------|-------------|
71-
| this\_ecs\_cluster\_arn | n/a |
72-
| this\_ecs\_cluster\_id | n/a |
74+
| this\_ecs\_cluster\_arn | ARN of the ECS Cluster |
75+
| this\_ecs\_cluster\_id | ID of the ECS Cluster |
7376
| this\_ecs\_cluster\_name | The name of the ECS cluster |
7477

7578
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/complete-ecs/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ Current version creates an high-available VPC with instances that are attached t
4141
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4242
## Requirements
4343

44-
No requirements.
44+
| Name | Version |
45+
|------|---------|
46+
| terraform | >= 0.12.6, < 0.14 |
47+
| aws | >= 2.0, < 4.0 |
48+
| template | ~> 2.0 |
4549

4650
## Providers
4751

4852
| Name | Version |
4953
|------|---------|
50-
| aws | n/a |
51-
| template | n/a |
54+
| aws | >= 2.0, < 4.0 |
55+
| template | ~> 2.0 |
5256

5357
## Inputs
5458

examples/complete-ecs/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ module "ecs" {
3737
container_insights = true
3838
}
3939

40-
module "ec2-profile" {
40+
module "ec2_profile" {
4141
source = "../../modules/ecs-instance-profile"
4242
name = local.name
4343
}
4444

4545
#----- ECS Services--------
4646

47-
module "hello-world" {
47+
module "hello_world" {
4848
source = "./service-hello-world"
4949
cluster_id = module.ecs.this_ecs_cluster_id
5050
}
@@ -80,16 +80,16 @@ module "this" {
8080
image_id = data.aws_ami.amazon_linux_ecs.id
8181
instance_type = "t2.micro"
8282
security_groups = [module.vpc.default_security_group_id]
83-
iam_instance_profile = module.ec2-profile.this_iam_instance_profile_id
83+
iam_instance_profile = module.ec2_profile.this_iam_instance_profile_id
8484
user_data = data.template_file.user_data.rendered
8585

8686
# Auto scaling group
8787
asg_name = local.ec2_resources_name
8888
vpc_zone_identifier = module.vpc.private_subnets
8989
health_check_type = "EC2"
90-
min_size = 1
90+
min_size = 0
9191
max_size = 2
92-
desired_capacity = 1
92+
desired_capacity = 0
9393
wait_for_capacity_timeout = 0
9494

9595
tags = [

examples/complete-ecs/outputs.tf

Whitespace-only changes.

examples/complete-ecs/service-hello-world/outputs.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.6, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.0, < 4.0"
6+
}
7+
}

examples/complete-ecs/variables.tf

Whitespace-only changes.

examples/complete-ecs/versions.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_version = ">= 0.12.6, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.0, < 4.0"
6+
template = "~> 2.0"
7+
}
8+
}

modules/ecs-instance-profile/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ resource "aws_iam_role_policy_attachment" "ecs_ec2_role" {
2828
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
2929
}
3030

31+
resource "aws_iam_role_policy_attachment" "amazon_ssm_managed_instance_core" {
32+
count = var.include_ssm ? 1 : 0
33+
34+
role = aws_iam_role.this.id
35+
policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
36+
}
37+
3138
resource "aws_iam_role_policy_attachment" "ecs_ec2_cloudwatch_role" {
3239
role = aws_iam_role.this.id
3340
policy_arn = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"

0 commit comments

Comments
 (0)