Skip to content

Commit 42931dd

Browse files
committed
chore: switching to role name
1 parent a19e05b commit 42931dd

3 files changed

Lines changed: 5 additions & 48 deletions

File tree

modules/remote_state/README.md

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,5 @@
11
# AWS OIDC Remote State Reader
22

3-
## Requirements
4-
5-
| Name | Version |
6-
| ------------------------------------------------------------------------ | ------- |
7-
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | >= 1.0 |
8-
9-
## Providers
10-
11-
| Name | Version |
12-
| ------------------------------------------------------------------ | ------- |
13-
| <a name="provider_aws"></a> [aws](#provider_aws) | 5.41.0 |
14-
| <a name="provider_terraform"></a> [terraform](#provider_terraform) | n/a |
15-
16-
## Modules
17-
18-
No modules.
19-
20-
## Resources
21-
22-
| Name | Type |
23-
| -------------------------------------------------------------------------------------------------------------------------------- | ----------- |
24-
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
25-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
26-
| [terraform_remote_state.this](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/data-sources/remote_state) | data source |
27-
28-
## Inputs
29-
30-
| Name | Description | Type | Default | Required |
31-
| ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | -------- | ------- | :------: |
32-
| <a name="input_account_id"></a> [account_id](#input_account_id) | Account ID where the remote state bucket is located | `string` | `null` | no |
33-
| <a name="input_reader_role_arn"></a> [reader_role_arn](#input_reader_role_arn) | The ARN of the reader role to assume in order to read the remote state | `string` | n/a | yes |
34-
| <a name="input_region"></a> [region](#input_region) | The region name where the destination resources have been created | `string` | `null` | no |
35-
| <a name="input_repository"></a> [repository](#input_repository) | The name of the repository to lookup remote state for | `string` | n/a | yes |
36-
| <a name="input_web_identity_token_file"></a> [web_identity_token_file](#input_web_identity_token_file) | Path to the web identity token file | `string` | n/a | yes |
37-
38-
## Outputs
39-
40-
| Name | Description |
41-
| -------------------------------------------------------- | ----------- |
42-
| <a name="output_outputs"></a> [outputs](#output_outputs) | n/a |
43-
443
<!-- BEGIN_TF_DOCS -->
454
## Providers
465

@@ -53,11 +12,10 @@ No modules.
5312

5413
| Name | Description | Type | Default | Required |
5514
|------|-------------|------|---------|:--------:|
15+
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | Account ID where the remote state bucket is located | `string` | n/a | yes |
5616
| <a name="input_repository"></a> [repository](#input\_repository) | The name of the repository to lookup remote state for | `string` | n/a | yes |
57-
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | Account ID where the remote state bucket is located | `string` | `null` | no |
58-
| <a name="input_reader_role_arn"></a> [reader\_role\_arn](#input\_reader\_role\_arn) | The ARN of the reader role to assume in order to read the remote state | `string` | `null` | no |
17+
| <a name="input_reader_role"></a> [reader\_role](#input\_reader\_role) | The name of the reader role to assume in order to read the remote state | `string` | `null` | no |
5918
| <a name="input_region"></a> [region](#input\_region) | The region name where the destination resources have been created | `string` | `null` | no |
60-
| <a name="input_remote_account_id"></a> [remote\_account\_id](#input\_remote\_account\_id) | The account ID where the remote state bucket is located (optional if you specify a reader\_role\_arn) | `string` | `null` | no |
6119
| <a name="input_web_identity_token_file"></a> [web\_identity\_token\_file](#input\_web\_identity\_token\_file) | Path to the web identity token file | `string` | `null` | no |
6220

6321
## Outputs
@@ -66,4 +24,3 @@ No modules.
6624
|------|-------------|
6725
| <a name="output_outputs"></a> [outputs](#output\_outputs) | n/a |
6826
<!-- END_TF_DOCS -->
69-

modules/remote_state/locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ locals {
1010
tf_state_bucket = format("%s-%s", local.account, local.region)
1111

1212
## Remote state role
13-
role_arn = coalesce(var.reader_role_arn, format("arn:aws:iam::%s:role/%s-sr", var.account_id, var.repository))
13+
role_arn = var.reader_role != null ? format("arn:aws:iam::%s:role/%s", local.account, var.reader_role) : format("arn:aws:iam::%s:role/%s-sr", local.account, var.repository)
1414
}
1515

modules/remote_state/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ variable "account_id" {
33
type = string
44
}
55

6-
variable "reader_role_arn" {
7-
description = "The ARN of the reader role to assume in order to read the remote state"
6+
variable "reader_role" {
7+
description = "The name of the reader role to assume in order to read the remote state"
88
type = string
99
default = null
1010
}

0 commit comments

Comments
 (0)