Skip to content
This repository was archived by the owner on Jul 20, 2024. It is now read-only.

Commit 5a3d3f4

Browse files
add ssm_policy variable (#45)
1 parent 38e00a2 commit 5a3d3f4

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

‎README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,26 @@ No requirements.
165165

166166
| Name | Description | Type | Default | Required |
167167
|------|-------------|------|---------|:--------:|
168-
| enabled | Enable or not costly resources | `bool` | `true` | no |
169-
| image\_id | AMI of the NAT instance. Default to the latest Amazon Linux 2 | `string` | `""` | no |
170-
| instance\_types | Candidates of spot instance type for the NAT instance. This is used in the mixed instances policy | `list` | <pre>[<br> "t3.nano",<br> "t3a.nano"<br>]</pre> | no |
171-
| key\_name | Name of the key pair for the NAT instance. You can set this to assign the key pair to the NAT instance | `string` | `""` | no |
172-
| name | Name for all the resources as identifier | `string` | n/a | yes |
173-
| private\_route\_table\_ids | List of ID of the route tables for the private subnets. You can set this to assign the each default route to the NAT instance | `list` | `[]` | no |
174-
| private\_subnets\_cidr\_blocks | List of CIDR blocks of the private subnets. The NAT instance accepts connections from this subnets | `list` | n/a | yes |
175-
| public\_subnet | ID of the public subnet to place the NAT instance | `string` | n/a | yes |
176-
| tags | Tags applied to resources created with this module | `map` | `{}` | no |
177-
| use\_spot\_instance | Whether to use spot or on-demand EC2 instance | `bool` | `true` | no |
178-
| user\_data\_runcmd | Additional runcmd section of cloud-init | `list` | `[]` | no |
179-
| user\_data\_write\_files | Additional write\_files section of cloud-init | `list` | `[]` | no |
180-
| vpc\_id | ID of the VPC | `string` | n/a | yes |
168+
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Enable or not costly resources | `bool` | `true` | no |
169+
| <a name="input_image_id"></a> [image\_id](#input\_image\_id) | AMI of the NAT instance. Default to the latest Amazon Linux 2 | `string` | `""` | no |
170+
| <a name="input_instance_types"></a> [instance\_types](#input\_instance\_types) | Candidates of spot instance type for the NAT instance. This is used in the mixed instances policy | `list(string)` | <pre>[<br> "t3.nano",<br> "t3a.nano"<br>]</pre> | no |
171+
| <a name="input_key_name"></a> [key\_name](#input\_key\_name) | Name of the key pair for the NAT instance. You can set this to assign the key pair to the NAT instance | `string` | `""` | no |
172+
| <a name="input_name"></a> [name](#input\_name) | Name for all the resources as identifier | `string` | n/a | yes |
173+
| <a name="input_private_route_table_ids"></a> [private\_route\_table\_ids](#input\_private\_route\_table\_ids) | List of ID of the route tables for the private subnets. You can set this to assign the each default route to the NAT instance | `list(string)` | `[]` | no |
174+
| <a name="input_private_subnets_cidr_blocks"></a> [private\_subnets\_cidr\_blocks](#input\_private\_subnets\_cidr\_blocks) | List of CIDR blocks of the private subnets. The NAT instance accepts connections from this subnets | `list(string)` | n/a | yes |
175+
| <a name="input_public_subnet"></a> [public\_subnet](#input\_public\_subnet) | ID of the public subnet to place the NAT instance | `string` | n/a | yes |
176+
| <a name="input_ssm_policy_arn"></a> [ssm\_policy\_arn](#input\_ssm\_policy\_arn) | SSM Policy to be attached to instance profile | `string` | `"arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"` | no |
177+
| <a name="input_tags"></a> [tags](#input\_tags) | Tags applied to resources created with this module | `map(string)` | `{}` | no |
178+
| <a name="input_use_spot_instance"></a> [use\_spot\_instance](#input\_use\_spot\_instance) | Whether to use spot or on-demand EC2 instance | `bool` | `true` | no |
179+
| <a name="input_user_data_runcmd"></a> [user\_data\_runcmd](#input\_user\_data\_runcmd) | Additional runcmd section of cloud-init | `list(list(string))` | `[]` | no |
180+
| <a name="input_user_data_write_files"></a> [user\_data\_write\_files](#input\_user\_data\_write\_files) | Additional write\_files section of cloud-init | `list(any)` | `[]` | no |
181+
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | ID of the VPC | `string` | n/a | yes |
181182

182183
## Outputs
183184

184185
| Name | Description |
185186
|------|-------------|
186-
| eni\_id | ID of the ENI for the NAT instance |
187-
| eni\_private\_ip | Private IP of the ENI for the NAT instance |
188-
| iam\_role\_name | Name of the IAM role for the NAT instance |
189-
| sg\_id | ID of the security group of the NAT instance |
190-
187+
| <a name="output_eni_id"></a> [eni\_id](#output\_eni\_id) | ID of the ENI for the NAT instance |
188+
| <a name="output_eni_private_ip"></a> [eni\_private\_ip](#output\_eni\_private\_ip) | Private IP of the ENI for the NAT instance |
189+
| <a name="output_iam_role_name"></a> [iam\_role\_name](#output\_iam\_role\_name) | Name of the IAM role for the NAT instance |
190+
| <a name="output_sg_id"></a> [sg\_id](#output\_sg\_id) | ID of the security group of the NAT instance |

‎main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ EOF
180180
}
181181

182182
resource "aws_iam_role_policy_attachment" "ssm" {
183-
policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
183+
policy_arn = var.ssm_policy_arn
184184
role = aws_iam_role.this.name
185185
}
186186

‎variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ locals {
8282
var.tags,
8383
)
8484
}
85+
86+
variable "ssm_policy_arn" {
87+
description = "SSM Policy to be attached to instance profile"
88+
type = string
89+
default = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
90+
}

0 commit comments

Comments
 (0)