Skip to content

Commit

Permalink
Add role outputs (#40)
Browse files Browse the repository at this point in the history
* Add role outputs

* Use local.iam_role_arn

* Auto Format

* Update outputs.tf

* Remove unused providers

* Auto Format

Co-authored-by: cloudpossebot <[email protected]>
  • Loading branch information
nitrocode and cloudpossebot authored Jun 18, 2022
1 parent 4ee3a66 commit 9e08ed5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
":preserveSemverRanges"
],
"labels": ["auto-update"],
"dependencyDashboardAutoclose": true,
"enabledManagers": ["terraform"],
"terraform": {
"ignorePaths": ["**/context.tf", "examples/**"]
}
}

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ Available targets:
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.2 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |

## Providers

Expand Down Expand Up @@ -274,6 +272,8 @@ Available targets:
| <a name="output_backup_selection_id"></a> [backup\_selection\_id](#output\_backup\_selection\_id) | Backup Selection ID |
| <a name="output_backup_vault_arn"></a> [backup\_vault\_arn](#output\_backup\_vault\_arn) | Backup Vault ARN |
| <a name="output_backup_vault_id"></a> [backup\_vault\_id](#output\_backup\_vault\_id) | Backup Vault ID |
| <a name="output_role_arn"></a> [role\_arn](#output\_role\_arn) | The Amazon Resource Name (ARN) specifying the role |
| <a name="output_role_name"></a> [role\_name](#output\_role\_name) | The name of the IAM role created |
<!-- markdownlint-restore -->


Expand Down
4 changes: 2 additions & 2 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.2 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |

## Providers

Expand Down Expand Up @@ -87,4 +85,6 @@
| <a name="output_backup_selection_id"></a> [backup\_selection\_id](#output\_backup\_selection\_id) | Backup Selection ID |
| <a name="output_backup_vault_arn"></a> [backup\_vault\_arn](#output\_backup\_vault\_arn) | Backup Vault ARN |
| <a name="output_backup_vault_id"></a> [backup\_vault\_id](#output\_backup\_vault\_id) | Backup Vault ID |
| <a name="output_role_arn"></a> [role\_arn](#output\_role\_arn) | The Amazon Resource Name (ARN) specifying the role |
| <a name="output_role_name"></a> [role\_name](#output\_role\_name) | The name of the IAM role created |
<!-- markdownlint-restore -->
8 changes: 0 additions & 8 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,5 @@ terraform {
source = "hashicorp/aws"
version = ">= 2.0"
}
local = {
source = "hashicorp/local"
version = ">= 1.2"
}
null = {
source = "hashicorp/null"
version = ">= 2.0"
}
}
}
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ locals {
plan_enabled = local.enabled && var.plan_enabled
iam_role_enabled = local.enabled && var.iam_role_enabled
iam_role_name = coalesce(var.iam_role_name, module.label_backup_role.id)
iam_role_arn = join("", var.iam_role_enabled ? aws_iam_role.default.*.arn : data.aws_iam_role.existing.*.arn)
vault_enabled = local.enabled && var.vault_enabled
vault_name = coalesce(var.vault_name, module.this.id)
vault_id = join("", local.vault_enabled ? aws_backup_vault.default.*.id : data.aws_backup_vault.existing.*.id)
Expand Down Expand Up @@ -108,7 +109,7 @@ resource "aws_iam_role_policy_attachment" "default" {
resource "aws_backup_selection" "default" {
count = local.plan_enabled ? 1 : 0
name = module.this.id
iam_role_arn = join("", var.iam_role_enabled ? aws_iam_role.default.*.arn : data.aws_iam_role.existing.*.arn)
iam_role_arn = local.iam_role_arn
plan_id = join("", aws_backup_plan.default.*.id)
resources = var.backup_resources
not_resources = var.not_resources
Expand Down
10 changes: 10 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ output "backup_selection_id" {
value = join("", aws_backup_selection.default.*.id)
description = "Backup Selection ID"
}

output "role_name" {
value = local.iam_role_name
description = "The name of the IAM role created"
}

output "role_arn" {
value = local.iam_role_arn
description = "The Amazon Resource Name (ARN) specifying the role"
}
8 changes: 0 additions & 8 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,5 @@ terraform {
source = "hashicorp/aws"
version = ">= 2.0"
}
local = {
source = "hashicorp/local"
version = ">= 1.2"
}
null = {
source = "hashicorp/null"
version = ">= 2.0"
}
}
}

0 comments on commit 9e08ed5

Please sign in to comment.