73 lines
2.1 KiB
HCL
73 lines
2.1 KiB
HCL
provider "aws" {
|
|
alias = "osaka"
|
|
region = "ap-northeast-3"
|
|
}
|
|
|
|
provider "aws" {
|
|
alias = "billing"
|
|
region = "us-east-1"
|
|
}
|
|
|
|
variables {
|
|
region = "ap-northeast-3"
|
|
name_prefix = "tftest-g1-7f3a"
|
|
|
|
protect_from_destroy = false
|
|
force_destroy_unprotected_buckets = true
|
|
|
|
trail_name = "tftest-g1-7f3a-management-events"
|
|
cloudtrail_is_multi_region = false
|
|
|
|
kms_alias_name = "alias/tftest-g1-7f3a-vault"
|
|
kms_deletion_window_in_days = 7
|
|
|
|
log_groups = {
|
|
vpc_flowlogs = {
|
|
name = "/tftest/g1/7f3a/flowlogs"
|
|
retention_in_days = 1
|
|
}
|
|
}
|
|
|
|
billing_alarm_name = "tftest-g1-7f3a-billing"
|
|
billing_alarm_action_arns = []
|
|
}
|
|
|
|
run "plan_group1_osaka" {
|
|
command = plan
|
|
|
|
providers = {
|
|
aws = aws.osaka
|
|
aws.us_east_1 = aws.billing
|
|
}
|
|
|
|
assert {
|
|
condition = length(aws_s3_bucket.unprotected) == 2 && alltrue([for bucket in aws_s3_bucket.unprotected : bucket.force_destroy])
|
|
error_message = "The Osaka test must create two unprotected, force-destroyable S3 buckets."
|
|
}
|
|
|
|
assert {
|
|
condition = length(aws_s3_bucket.access_logs_unprotected) == 1 && aws_s3_bucket.access_logs_unprotected[0].force_destroy
|
|
error_message = "The Osaka test must create one unprotected, force-destroyable S3 access log bucket."
|
|
}
|
|
|
|
assert {
|
|
condition = aws_s3_bucket.access_logs_unprotected[0].bucket_namespace == "global"
|
|
error_message = "The Osaka test must keep the S3 access log bucket in the default global namespace."
|
|
}
|
|
|
|
assert {
|
|
condition = !aws_cloudtrail.management_events.is_multi_region_trail
|
|
error_message = "The Osaka test CloudTrail trail must be single-Region."
|
|
}
|
|
|
|
assert {
|
|
condition = aws_kms_key.vault_unprotected[0].deletion_window_in_days == 7
|
|
error_message = "The Osaka test KMS key must use the minimum seven-day deletion window."
|
|
}
|
|
|
|
assert {
|
|
condition = try(length(aws_cloudwatch_metric_alarm.billing.alarm_actions), 0) == 0
|
|
error_message = "The Osaka test billing alarm must not notify production targets."
|
|
}
|
|
}
|