Skip to content

Commit 57af399

Browse files
author
Abdul Wahid
authored
target_vault_name reference a resource not a variable (#2)
* Add depends on to fix the occasional race condition * Add changelog * Use resource and not variable for 'depends_on' * Add comment for depends_on * Fix target_vault_name should be referencing a resource and not a variable * Remove unreleased part for Changelog * Fix expression for target_vault_name * New expression for target_vault_name
1 parent fd12929 commit 57af399

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
<a name="1.0.0"></a>
6+
## 1.0.0 - 2020-11-09
7+
8+
- Complete AWS Backup module ([#1](https://github.com/umotif-public/terraform-aws-backup/issues/1))
9+
- Initial commit
10+
11+
12+
[Unreleased]: https://github.com/umotif-public/terraform-aws-backup/compare/1.0.0...HEAD

examples/external-vault/main.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,6 @@ module "backup" {
106106
tags = {
107107
Environment = "test"
108108
}
109-
}
109+
110+
depends_on = [aws_backup_vault.external_vault]
111+
}

examples/one-db/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ module "backup" {
168168
rules = [
169169
{
170170
name = "test-backup-rule"
171-
target_vault_name = "test-rds-aurora"
172171
schedule = "cron(0 12 * * ? *)"
173172
start_window = "65"
174173
completion_window = "180"

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ resource "aws_backup_plan" "main" {
1919
for_each = var.rules
2020
content {
2121
rule_name = lookup(rule.value, "name")
22-
target_vault_name = lookup(rule.value, "target_vault_name", null) == null ? var.vault_name : lookup(rule.value, "target_vault_name", "Default")
22+
target_vault_name = var.vault_name != null ? aws_backup_vault.main[0].name : lookup(rule.value, "target_vault_name", "Default")
2323
schedule = lookup(rule.value, "schedule", null)
2424
start_window = lookup(rule.value, "start_window", null)
2525
completion_window = lookup(rule.value, "completion_window", null)

0 commit comments

Comments
 (0)