Skip to content

Commit

Permalink
target_vault_name reference a resource not a variable (#2)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Abdul Wahid authored Nov 13, 2020
1 parent fd12929 commit 57af399
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Change Log

All notable changes to this project will be documented in this file.

<a name="1.0.0"></a>
## 1.0.0 - 2020-11-09

- Complete AWS Backup module ([#1](https://github.com/umotif-public/terraform-aws-backup/issues/1))
- Initial commit


[Unreleased]: https://github.com/umotif-public/terraform-aws-backup/compare/1.0.0...HEAD
4 changes: 3 additions & 1 deletion examples/external-vault/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ module "backup" {
tags = {
Environment = "test"
}
}

depends_on = [aws_backup_vault.external_vault]
}
1 change: 0 additions & 1 deletion examples/one-db/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ module "backup" {
rules = [
{
name = "test-backup-rule"
target_vault_name = "test-rds-aurora"
schedule = "cron(0 12 * * ? *)"
start_window = "65"
completion_window = "180"
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "aws_backup_plan" "main" {
for_each = var.rules
content {
rule_name = lookup(rule.value, "name")
target_vault_name = lookup(rule.value, "target_vault_name", null) == null ? var.vault_name : lookup(rule.value, "target_vault_name", "Default")
target_vault_name = var.vault_name != null ? aws_backup_vault.main[0].name : lookup(rule.value, "target_vault_name", "Default")
schedule = lookup(rule.value, "schedule", null)
start_window = lookup(rule.value, "start_window", null)
completion_window = lookup(rule.value, "completion_window", null)
Expand Down

0 comments on commit 57af399

Please sign in to comment.