Skip to content

Commit 0e7f825

Browse files
committed
Add iam_deploy option, defaults to true
1 parent 40be9f9 commit 0e7f825

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Here's the gist of using it directly from github.
138138
| bucket | Backup and Restore bucket. | `string` | n/a | yes |
139139
| cluster\_name | Cluster name. | `string` | n/a | yes |
140140
| description | Namespace description | `string` | `"velero-back-up-and-restore"` | no |
141+
| iam\_deploy | whther or not to deploy iam role | `bool` | `true` | no |
141142
| name | namespace name | `string` | `"velero"` | no |
142143
| namespace\_deploy | whther or not to deploy namespace | `bool` | `false` | no |
143144
| openid\_connect\_provider\_uri | OpenID Connect Provider for EKS to enable IRSA. | `string` | n/a | yes |
@@ -157,10 +158,10 @@ Here's the gist of using it directly from github.
157158

158159
<!-- START makefile-doc -->
159160
```
160-
$ make help
161+
$ make help
161162
hooks Commit hooks setup
162163
validate Validate with pre-commit hooks
163-
changelog Update changelog
164+
changelog Update changelog
164165
```
165166
<!-- END makefile-doc -->
166167

iam.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ data aws_iam_policy_document policy {
6262
}
6363

6464
resource aws_iam_role this {
65+
count = var.iam_deploy ? 1 : 0
6566
name = format("%s-%s", var.cluster_name, var.name)
6667
assume_role_policy = data.aws_iam_policy_document.assume_role.json
6768
tags = merge(var.tags,
@@ -72,7 +73,8 @@ resource aws_iam_role this {
7273
}
7374

7475
resource aws_iam_role_policy this {
76+
count = var.iam_deploy ? 1 : 0
7577
name = format("%s-%s", var.cluster_name, var.name)
76-
role = aws_iam_role.this.id
78+
role = element(aws_iam_role.this.*.id, 0)
7779
policy = data.aws_iam_policy_document.policy.json
7880
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ variable "app_deploy" {
1515
type = bool
1616
}
1717

18+
variable "iam_deploy" {
19+
default = true
20+
description = "whther or not to deploy iam role"
21+
type = bool
22+
}
23+
1824
variable "name" {
1925
default = "velero"
2026
description = "namespace name"

0 commit comments

Comments
 (0)