Skip to content

Commit 25aafec

Browse files
rsrchboymaximmi
andauthored
Allow a permissions boundary to be attached (#52)
...as these things are useful, but must be attached to the role at creation. Co-authored-by: Maxim Mironenko <simixido@gmail.com>
1 parent cf655e3 commit 25aafec

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ Available targets:
183183
| monitoring | Launched EC2 instance will have detailed monitoring enabled | bool | `true` | no |
184184
| name | Name (e.g. `bastion` or `db`) | string | - | yes |
185185
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | `` | no |
186+
| permissions_boundary_arn | Policy ARN to attach to instance role as a permissions boundary | string | `` | no |
186187
| private_ip | Private IP address to associate with the instance in the VPC | string | `` | no |
187188
| region | AWS Region the instance is launched in | string | `` | no |
188189
| root_iops | Amount of provisioned IOPS. This must be set if root_volume_type is set to `io1` | number | `0` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
| monitoring | Launched EC2 instance will have detailed monitoring enabled | bool | `true` | no |
3636
| name | Name (e.g. `bastion` or `db`) | string | - | yes |
3737
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | `` | no |
38+
| permissions_boundary_arn | Policy ARN to attach to instance role as a permissions boundary | string | `` | no |
3839
| private_ip | Private IP address to associate with the instance in the VPC | string | `` | no |
3940
| region | AWS Region the instance is launched in | string | `` | no |
4041
| root_iops | Amount of provisioned IOPS. This must be set if root_volume_type is set to `io1` | number | `0` | no |

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ resource "aws_iam_instance_profile" "default" {
8282
}
8383

8484
resource "aws_iam_role" "default" {
85-
count = local.instance_count
86-
name = module.label.id
87-
path = "/"
88-
assume_role_policy = data.aws_iam_policy_document.default.json
85+
count = local.instance_count
86+
name = module.label.id
87+
path = "/"
88+
assume_role_policy = data.aws_iam_policy_document.default.json
89+
permissions_boundary = var.permissions_boundary_arn
8990
}
9091

9192
resource "aws_instance" "default" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,9 @@ variable "additional_ips_count" {
281281
description = "Count of additional EIPs"
282282
default = 0
283283
}
284+
285+
variable "permissions_boundary_arn" {
286+
type = string
287+
description = "Policy ARN to attach to instance role as a permissions boundary"
288+
default = ""
289+
}

0 commit comments

Comments
 (0)