Skip to content

Commit 12dd76b

Browse files
authored
Enable terraform plan access via dynamic Terraform roles (cloudposse/terraform-aws-components#715)
1 parent 746c7b4 commit 12dd76b

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

src/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ components:
7070
| <a name="input_filter_tags"></a> [filter\_tags](#input\_filter\_tags) | An array of EC2 tags (in the form `key:value`) that defines a filter that Datadog use when collecting metrics from EC2. Wildcards, such as ? (for single characters) and * (for multiple characters) can also be used | `list(string)` | `[]` | no |
7171
| <a name="input_host_tags"></a> [host\_tags](#input\_host\_tags) | An array of tags (in the form `key:value`) to add to all hosts and metrics reporting through this integration | `list(string)` | `[]` | no |
7272
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
73-
| <a name="input_import_profile_name"></a> [import\_profile\_name](#input\_import\_profile\_name) | AWS Profile name to use when importing a resource | `string` | `null` | no |
74-
| <a name="input_import_role_arn"></a> [import\_role\_arn](#input\_import\_role\_arn) | IAM Role ARN to use when importing a resource | `string` | `null` | no |
7573
| <a name="input_included_regions"></a> [included\_regions](#input\_included\_regions) | An array of AWS regions to include in metrics collection | `list(string)` | `[]` | no |
7674
| <a name="input_integrations"></a> [integrations](#input\_integrations) | List of AWS permission names to apply for different integrations (e.g. 'all', 'core') | `list(string)` | <pre>[<br> "all"<br>]</pre> | no |
7775
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |

src/providers.tf

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
provider "aws" {
22
region = var.region
33

4-
profile = module.iam_roles.profiles_enabled ? coalesce(var.import_profile_name, module.iam_roles.terraform_profile_name) : null
4+
# Profile is deprecated in favor of terraform_role_arn. When profiles are not in use, terraform_profile_name is null.
5+
profile = module.iam_roles.terraform_profile_name
56

67
dynamic "assume_role" {
7-
for_each = module.iam_roles.profiles_enabled ? [] : ["role"]
8+
# module.iam_roles.terraform_role_arn may be null, in which case do not assume a role.
9+
for_each = compact([module.iam_roles.terraform_role_arn])
810
content {
9-
role_arn = coalesce(var.import_role_arn, module.iam_roles.terraform_role_arn)
11+
role_arn = module.iam_roles.terraform_role_arn
1012
}
1113
}
1214
}
@@ -15,15 +17,3 @@ module "iam_roles" {
1517
source = "../account-map/modules/iam-roles"
1618
context = module.this.context
1719
}
18-
19-
variable "import_profile_name" {
20-
type = string
21-
default = null
22-
description = "AWS Profile name to use when importing a resource"
23-
}
24-
25-
variable "import_role_arn" {
26-
type = string
27-
default = null
28-
description = "IAM Role ARN to use when importing a resource"
29-
}

0 commit comments

Comments
 (0)