diff --git a/README.md b/README.md index e955ec8..ff6995e 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,22 @@ Available targets: |------|---------| | aws | >= 2.0 | +## Modules + +| Name | Source | Version | +|------|--------|---------| +| label | cloudposse/label/null | 0.24.1 | +| this | cloudposse/label/null | 0.24.1 | + +## Resources + +| Name | +|------| +| [aws_eks_fargate_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_fargate_profile) | +| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | +| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | +| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | + ## Inputs | Name | Description | Type | Default | Required | @@ -246,6 +262,7 @@ Available targets: | label\_value\_case | The letter case of output label values (also used in `tags` and `id`).
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Default value: `lower`. | `string` | `null` | no | | name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no | | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | +| permissions\_boundary | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no | | regex\_replace\_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | | subnet\_ids | Identifiers of private EC2 Subnets to associate with the EKS Fargate Profile. These subnets must have the following resource tag: kubernetes.io/cluster/CLUSTER\_NAME (where CLUSTER\_NAME is replaced with the name of the EKS Cluster) | `list(string)` | n/a | yes | @@ -260,7 +277,6 @@ Available targets: | eks\_fargate\_profile\_role\_arn | ARN of the EKS Fargate Profile IAM role | | eks\_fargate\_profile\_role\_name | Name of the EKS Fargate Profile IAM role | | eks\_fargate\_profile\_status | Status of the EKS Fargate Profile | - diff --git a/docs/terraform.md b/docs/terraform.md index 8849cb7..6cab677 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -15,6 +15,22 @@ |------|---------| | aws | >= 2.0 | +## Modules + +| Name | Source | Version | +|------|--------|---------| +| label | cloudposse/label/null | 0.24.1 | +| this | cloudposse/label/null | 0.24.1 | + +## Resources + +| Name | +|------| +| [aws_eks_fargate_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_fargate_profile) | +| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | +| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | +| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | + ## Inputs | Name | Description | Type | Default | Required | @@ -35,6 +51,7 @@ | label\_value\_case | The letter case of output label values (also used in `tags` and `id`).
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Default value: `lower`. | `string` | `null` | no | | name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no | | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | +| permissions\_boundary | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no | | regex\_replace\_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | | subnet\_ids | Identifiers of private EC2 Subnets to associate with the EKS Fargate Profile. These subnets must have the following resource tag: kubernetes.io/cluster/CLUSTER\_NAME (where CLUSTER\_NAME is replaced with the name of the EKS Cluster) | `list(string)` | n/a | yes | @@ -49,5 +66,4 @@ | eks\_fargate\_profile\_role\_arn | ARN of the EKS Fargate Profile IAM role | | eks\_fargate\_profile\_role\_name | Name of the EKS Fargate Profile IAM role | | eks\_fargate\_profile\_status | Status of the EKS Fargate Profile | - diff --git a/main.tf b/main.tf index fb70e06..d7a33a4 100644 --- a/main.tf +++ b/main.tf @@ -32,10 +32,11 @@ data "aws_iam_policy_document" "assume_role" { } resource "aws_iam_role" "default" { - count = module.this.enabled ? 1 : 0 - name = "${module.label.id}${var.iam_role_kubernetes_namespace_delimiter}${var.kubernetes_namespace}" - assume_role_policy = join("", data.aws_iam_policy_document.assume_role.*.json) - tags = module.label.tags + count = module.this.enabled ? 1 : 0 + name = "${module.label.id}${var.iam_role_kubernetes_namespace_delimiter}${var.kubernetes_namespace}" + assume_role_policy = join("", data.aws_iam_policy_document.assume_role.*.json) + tags = module.label.tags + permissions_boundary = var.permissions_boundary } resource "aws_iam_role_policy_attachment" "amazon_eks_fargate_pod_execution_role_policy" { diff --git a/variables.tf b/variables.tf index 014a342..7bdf367 100644 --- a/variables.tf +++ b/variables.tf @@ -24,3 +24,9 @@ variable "iam_role_kubernetes_namespace_delimiter" { description = "Delimiter for the Kubernetes namespace in the IAM Role name" default = "-" } + +variable "permissions_boundary" { + type = string + default = null + description = "If provided, all IAM roles will be created with this permissions boundary attached." +}