-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New 'not_resources' feature + version compatibility (#17)
* Set minimum provider version to 4.26.0 to allow use of 'force_destroy' * Add new 'not_resources' feature * Lint fixes
- Loading branch information
Abdul Wahid
authored
Jul 14, 2023
1 parent
b658aa0
commit c9b3bbe
Showing
16 changed files
with
167 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## Example deployment flow | ||
|
||
```bash | ||
terraform init | ||
terraform validate | ||
terraform plan | ||
terraform apply --auto-approve | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
###### | ||
# KMS | ||
###### | ||
data "aws_kms_key" "backup" { | ||
key_id = "alias/aws/backup" | ||
} | ||
|
||
resource "aws_s3_bucket" "example" { | ||
bucket = "umotif-test-bucket" | ||
|
||
tags = { | ||
Environment = "test" | ||
} | ||
} | ||
|
||
######### | ||
# Backup | ||
######### | ||
module "backup" { | ||
source = "../.." | ||
|
||
# Create a vault | ||
vault_name = "${var.name_prefix}-vault-exclusions" | ||
vault_kms_key_arn = data.aws_kms_key.backup.arn | ||
|
||
# Create a backup plan | ||
plan_name = "${var.name_prefix}-backup-plan" | ||
|
||
rules = [ | ||
{ | ||
name = "${var.name_prefix}-backup-rule" | ||
schedule = "cron(0 12 * * ? *)" | ||
start_window = "65" | ||
completion_window = "180" | ||
recovery_point_tags = { | ||
Project = "test" | ||
Region = "eu-west-1" | ||
} | ||
|
||
lifecycle = { | ||
delete_after = 90 | ||
} | ||
} | ||
] | ||
|
||
selection_name = "${var.name_prefix}-backup-selection" | ||
|
||
selection_resources = ["*"] | ||
selection_not_resources = [aws_s3_bucket.example.arn] | ||
|
||
tags = { | ||
Environment = "test" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
output "backup_vault_id" { | ||
description = "The name of the AWS Backup Vault" | ||
value = module.backup.backup_vault_id | ||
} | ||
|
||
output "backup_vault_arn" { | ||
description = "The Amazon Resource Name (ARN) that identifies the AWS Backup Vault" | ||
value = module.backup.backup_vault_arn | ||
} | ||
|
||
output "backup_vault_recovery_points" { | ||
description = "The number of recovery points that are stored in a backup vault" | ||
value = module.backup.backup_vault_recovery_points | ||
} | ||
|
||
output "backup_plan_id" { | ||
description = "The name of the backup plan" | ||
value = module.backup.backup_plan_id | ||
} | ||
|
||
output "backup_plan_arn" { | ||
description = "The Amazon Resource Name (ARN) that identifies the backup plan" | ||
value = module.backup.backup_plan_arn | ||
} | ||
|
||
output "backup_plan_version" { | ||
description = "Unique, randomly generated, Unicode, UTF-8 encoded string that serves as the version ID of the backup plan." | ||
value = module.backup.backup_plan_version | ||
} | ||
|
||
output "backup_selection_id" { | ||
description = "The identifier of the backup selection" | ||
value = module.backup.backup_selection_id | ||
} | ||
|
||
output "backup_vault_iam_role_name" { | ||
description = "The name of the backup IAM role" | ||
value = module.backup.backup_vault_iam_role_name | ||
} | ||
|
||
output "backup_vault_iam_role_arn" { | ||
description = "The ARN of the backup IAM role" | ||
value = module.backup.backup_vault_iam_role_arn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
variable "name_prefix" { | ||
description = "A prefix used for naming resources." | ||
type = string | ||
default = "example" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = "~> 1.5.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.26.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0.11" | ||
required_version = ">= 1.5.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.0.0" | ||
version = ">= 4.26.0" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0.11" | ||
required_version = ">= 1.5.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.0.0" | ||
version = ">= 4.26.0" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0.11" | ||
required_version = ">= 1.5.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.0.0" | ||
version = ">= 4.26.0" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0.11" | ||
required_version = ">= 1.5.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.0.0" | ||
version = ">= 4.26.0" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0.11" | ||
required_version = ">= 1.5.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.0.0" | ||
version = ">= 4.26.0" | ||
} | ||
} | ||
} |