Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix_ssm_attachment #24

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ module "ad2" {

| Name | Source | Version |
|------|--------|---------|
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | github.com/Coalfire-CF/terraform-aws-securitygroup | b6e9070a3f6201d75160c42a3f649d36cb9b2622 |
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | github.com/Coalfire-CF/terraform-aws-securitygroup | v1.0.1 |

## Resources

Expand Down Expand Up @@ -216,16 +216,16 @@ module "ad2" {
| <a name="input_assume_role_policy"></a> [assume\_role\_policy](#input\_assume\_role\_policy) | Policy document allowing Principals to assume this role (e.g. Trust Relationship) | `string` | `"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Action\": \"sts:AssumeRole\",\n \"Principal\": {\n \"Service\": \"ec2.amazonaws.com\"\n },\n \"Effect\": \"Allow\",\n \"Sid\": \"\"\n }\n ]\n}\n"` | no |
| <a name="input_ebs_kms_key_arn"></a> [ebs\_kms\_key\_arn](#input\_ebs\_kms\_key\_arn) | The ARN of the KMS key to encrypt EBS volumes | `string` | n/a | yes |
| <a name="input_ebs_optimized"></a> [ebs\_optimized](#input\_ebs\_optimized) | Whether or not the instance is ebs optimized | `bool` | `true` | no |
| <a name="input_ebs_volumes"></a> [ebs\_volumes](#input\_ebs\_volumes) | A list of maps that must contain device\_name (ex. '/dev/sdb') and size (in GB). Optional args include type, throughput, iops, multi\_attach\_enabled, final\_snapshot, snapshot\_id, outpost\_arn, force\_detach, skip\_destroy, stop\_instance\_before\_detaching, and tags | <pre>list(object({<br> device_name = string<br> size = number<br> type = string<br> throughput = optional(number)<br> iops = optional(number)<br> multi_attach_enabled = optional(bool, false)<br> final_snapshot = optional(string)<br> snapshot_id = optional(string)<br> outpost_arn = optional(string)<br> force_detach = optional(bool, false)<br> skip_destroy = optional(bool, false)<br> stop_instance_before_detaching = optional(bool, false)<br> tags = optional(map(string), {})<br> }))</pre> | `[]` | no |
| <a name="input_ebs_volumes"></a> [ebs\_volumes](#input\_ebs\_volumes) | A list of maps that must contain device\_name (ex. '/dev/sdb') and size (in GB). Optional args include type, throughput, iops, multi\_attach\_enabled, final\_snapshot, snapshot\_id, outpost\_arn, force\_detach, skip\_destroy, stop\_instance\_before\_detaching, and tags | <pre>list(object({<br/> device_name = string<br/> size = number<br/> type = string<br/> throughput = optional(number)<br/> iops = optional(number)<br/> multi_attach_enabled = optional(bool, false)<br/> final_snapshot = optional(string)<br/> snapshot_id = optional(string)<br/> outpost_arn = optional(string)<br/> force_detach = optional(bool, false)<br/> skip_destroy = optional(bool, false)<br/> stop_instance_before_detaching = optional(bool, false)<br/> tags = optional(map(string), {})<br/> }))</pre> | `[]` | no |
| <a name="input_ec2_instance_type"></a> [ec2\_instance\_type](#input\_ec2\_instance\_type) | The type of instance to start | `string` | n/a | yes |
| <a name="input_ec2_key_pair"></a> [ec2\_key\_pair](#input\_ec2\_key\_pair) | The key name to use for the instance | `string` | n/a | yes |
| <a name="input_egress_rules"></a> [egress\_rules](#input\_egress\_rules) | The list of rules for egress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>map(object({<br> cidr_ipv4 = optional(string, null)<br> cidr_ipv6 = optional(string, null)<br> description = optional(string, "Managed by Terraform")<br> from_port = optional(string, null)<br> ip_protocol = optional(string, null)<br> prefix_list_id = optional(string, null)<br> referenced_security_group_id = optional(string, null)<br> to_port = optional(string, null)<br> }))</pre> | `{}` | no |
| <a name="input_egress_rules"></a> [egress\_rules](#input\_egress\_rules) | The list of rules for egress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>map(object({<br/> cidr_ipv4 = optional(string, null)<br/> cidr_ipv6 = optional(string, null)<br/> description = optional(string, "Managed by Terraform")<br/> from_port = optional(string, null)<br/> ip_protocol = optional(string, null)<br/> prefix_list_id = optional(string, null)<br/> referenced_security_group_id = optional(string, null)<br/> to_port = optional(string, null)<br/> }))</pre> | `{}` | no |
| <a name="input_get_password_data"></a> [get\_password\_data](#input\_get\_password\_data) | Whether or not to allow retrieval of the local admin password | `bool` | `false` | no |
| <a name="input_global_tags"></a> [global\_tags](#input\_global\_tags) | a map of strings that contains global level tags | `map(string)` | n/a | yes |
| <a name="input_http_tokens"></a> [http\_tokens](#input\_http\_tokens) | Whether or not the metadata service requires session tokens, required=IMDSv2, optional=IMDSv1 | `any` | `"required"` | no |
| <a name="input_iam_policies"></a> [iam\_policies](#input\_iam\_policies) | A list of the iam policy ARNs to attach to the IAM role | `list(string)` | `[]` | no |
| <a name="input_iam_profile"></a> [iam\_profile](#input\_iam\_profile) | A variable to attach an existing iam profile to the ec2 instance(s) created | `string` | `""` | no |
| <a name="input_ingress_rules"></a> [ingress\_rules](#input\_ingress\_rules) | The list of rules for ingress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>map(object({<br> cidr_ipv4 = optional(string, null)<br> cidr_ipv6 = optional(string, null)<br> description = optional(string, "Managed by Terraform")<br> from_port = optional(string, null)<br> ip_protocol = optional(string, null)<br> prefix_list_id = optional(string, null)<br> referenced_security_group_id = optional(string, null)<br> to_port = optional(string, null)<br> }))</pre> | `{}` | no |
| <a name="input_ingress_rules"></a> [ingress\_rules](#input\_ingress\_rules) | The list of rules for ingress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>map(object({<br/> cidr_ipv4 = optional(string, null)<br/> cidr_ipv6 = optional(string, null)<br/> description = optional(string, "Managed by Terraform")<br/> from_port = optional(string, null)<br/> ip_protocol = optional(string, null)<br/> prefix_list_id = optional(string, null)<br/> referenced_security_group_id = optional(string, null)<br/> to_port = optional(string, null)<br/> }))</pre> | `{}` | no |
| <a name="input_instance_count"></a> [instance\_count](#input\_instance\_count) | Number of instances to launch | `number` | `1` | no |
| <a name="input_keys_to_grant"></a> [keys\_to\_grant](#input\_keys\_to\_grant) | A list of kms keys to grant permissions to for the role created. | `list(string)` | `[]` | no |
| <a name="input_name"></a> [name](#input\_name) | The name of the ec2 instance | `string` | n/a | yes |
Expand Down
2 changes: 1 addition & 1 deletion iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ data "aws_iam_policy" "AmazonSSMManagedInstanceCore" {
}

resource "aws_iam_role_policy_attachment" "ssm_role_policy_attach" {
count = var.add_SSMManagedInstanceCore ? length(var.iam_policies) : 0
count = var.add_SSMManagedInstanceCore && length(var.iam_policies) > 0 ? 1 : 0
policy_arn = data.aws_iam_policy.AmazonSSMManagedInstanceCore.arn
role = aws_iam_role.this_role[0].name
}
Expand Down
2 changes: 1 addition & 1 deletion sg.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "security_group" {
source = "github.com/Coalfire-CF/terraform-aws-securitygroup?ref=b6e9070a3f6201d75160c42a3f649d36cb9b2622"
source = "github.com/Coalfire-CF/terraform-aws-securitygroup?ref=v1.0.1"

name = "${var.name}-sg"
description = var.sg_description
Expand Down
Loading