diff --git a/.gitignore b/.gitignore index 8bd5d1f..8c4af55 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,8 @@ venv.bak/ terraform.tfstate* .terraform* .fleet + +ses/ +ses.tf +backup/ +backup.tf \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7acf17a..321adab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,5 @@ repos: - id: terraform_tflint - id: terraform_tfsec - id: terrascan - - id: tfupdate - id: terraform_validate diff --git a/terraform/modules/acm/versions.tf b/terraform/modules/acm/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/acm/versions.tf +++ b/terraform/modules/acm/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/apigw/README.md b/terraform/modules/apigw/README.md index 91931a7..d699785 100644 --- a/terraform/modules/apigw/README.md +++ b/terraform/modules/apigw/README.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | 1.3.4 | +| [terraform](#requirement\_terraform) | >= 1.3.1 | | [aws](#requirement\_aws) | >= 4.10.0 | ## Providers diff --git a/terraform/modules/apigw/versions.tf b/terraform/modules/apigw/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/apigw/versions.tf +++ b/terraform/modules/apigw/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/backup/main.tf b/terraform/modules/backup/main.tf deleted file mode 100644 index ecbe759..0000000 --- a/terraform/modules/backup/main.tf +++ /dev/null @@ -1,34 +0,0 @@ -# ------------------------------------------------------------------------------ -# Amazon Backup -# ------------------------------------------------------------------------------ - -resource "aws_backup_vault" "this" { - name = var.vault_name -} - -resource "aws_backup_plan" "this" { - name = var.plan_name - - dynamic "rule" { - for_each = var.rules - - content { - rule_name = lookup(rule.value, "name", null) - target_vault_name = lookup(rule.value, "target_vault_name", null) - schedule = lookup(rule.value, "schedule", null) - start_window = lookup(rule.value, "start_window", null) - completion_window = lookup(rule.value, "completion_window", null) - enable_continuous_backup = lookup(rule.value, "enable_continuous_backup", null) - - dynamic "lifecycle" { - for_each = length(lookup(rule.value, "lifecycle", {})) == 0 ? [] : [lookup(rule.value, "lifecycle", {})] - content { - cold_storage_after = lookup(lifecycle.value, "cold_storage_after", 0) - delete_after = lookup(lifecycle.value, "delete_after", 90) - } - } - } - } - - depends_on = [aws_backup_vault.this] -} diff --git a/terraform/modules/backup/variables.tf b/terraform/modules/backup/variables.tf deleted file mode 100644 index 74a28c5..0000000 --- a/terraform/modules/backup/variables.tf +++ /dev/null @@ -1,92 +0,0 @@ -# ------------------------------------------------------------------------------ -# Amazon Backup variables -# ------------------------------------------------------------------------------ - -variable "vault_name" { - description = "Name of the backup vault to create. If not given, AWS use default" - type = string - default = null -} - -variable "plan_name" { - description = "The display name of a backup plan" - type = string -} - -variable "rule_name" { - description = "An display name for a backup rule" - type = string - default = null -} - -variable "rule_schedule" { - description = "A CRON expression specifying when AWS Backup initiates a backup job" - type = string - default = null -} - -variable "rule_start_window" { - description = "The amount of time in minutes before beginning a backup" - type = number - default = null -} - -variable "rule_completion_window" { - description = "The amount of time AWS Backup attempts a backup before canceling the job and returning an error" - type = number - default = null -} - -# variable "rule_recovery_point_tags" { -# description = "Metadata that you can assign to help organize the resources that you create" -# type = map(string) -# default = {} -# } - -variable "rule_lifecycle_cold_storage_after" { - description = "Specifies the number of days after creation that a recovery point is moved to cold storage" - type = number - default = null -} - -variable "rule_lifecycle_delete_after" { - description = "Specifies the number of days after creation that a recovery point is deleted. Must be 90 days greater than `cold_storage_after`" - type = number - default = null -} - -# variable "rule_copy_action_lifecycle" { -# description = "The lifecycle defines when a protected resource is copied over to a backup vault and when it expires." -# type = map(any) -# default = {} -# } - -# variable "rule_copy_action_destination_vault_arn" { -# description = "An Amazon Resource Name (ARN) that uniquely identifies the destination backup vault for the copied backup." -# type = string -# default = null -# } - -variable "rule_enable_continuous_backup" { - description = "Enable continuous backups for supported resources." - type = bool - default = false -} - -variable "rules" { - description = "A list of rule maps" - type = any - default = [] -} - -variable "selections" { - description = "A list of selction maps" - type = any - default = [] -} - -variable "tags" { - description = "A mapping of tags to assign to the resource" - type = map(string) - default = {} -} \ No newline at end of file diff --git a/terraform/modules/backup/versions.tf b/terraform/modules/backup/versions.tf deleted file mode 100644 index 3861683..0000000 --- a/terraform/modules/backup/versions.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - required_version = "1.3.4" - - required_providers { - aws = { - source = "hashicorp/aws" - version = ">= 4.10.0" - } - } -} diff --git a/terraform/modules/cloudfront/README.md b/terraform/modules/cloudfront/README.md index dd772e3..72c45db 100644 --- a/terraform/modules/cloudfront/README.md +++ b/terraform/modules/cloudfront/README.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | 1.3.4 | +| [terraform](#requirement\_terraform) | >= 1.3.1 | | [aws](#requirement\_aws) | >= 4.10.0 | ## Providers @@ -26,6 +26,8 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| [acm\_certificate\_arn](#input\_acm\_certificate\_arn) | ACM certificate. | `string` | n/a | yes | +| [aliases](#input\_aliases) | Domain aliases. | `any` | n/a | yes | | [default\_cache\_behavior](#input\_default\_cache\_behavior) | The default cache behavior for this distribution | `any` | n/a | yes | | [default\_root\_object](#input\_default\_root\_object) | The object that you want CloudFront to return (for example, index.html) when an end user requests the root URL. | `string` | `null` | no | | [enabled](#input\_enabled) | Whether the distribution is enabled to accept end user requests for content. | `bool` | `true` | no | @@ -35,5 +37,8 @@ No modules. ## Outputs -No outputs. +| Name | Description | +|------|-------------| +| [distribution\_domain\_name](#output\_distribution\_domain\_name) | The domain name corresponding to the distribution. | +| [distribution\_hosted\_zone\_id](#output\_distribution\_hosted\_zone\_id) | The CloudFront Route 53 zone ID that can be used to route an Alias Resource Record Set to. | \ No newline at end of file diff --git a/terraform/modules/cloudfront/versions.tf b/terraform/modules/cloudfront/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/cloudfront/versions.tf +++ b/terraform/modules/cloudfront/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/cognito/versions.tf b/terraform/modules/cognito/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/cognito/versions.tf +++ b/terraform/modules/cognito/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/dynamodb/README.md b/terraform/modules/dynamodb/README.md index 0beafe7..f0b2dc3 100644 --- a/terraform/modules/dynamodb/README.md +++ b/terraform/modules/dynamodb/README.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | 1.3.4 | +| [terraform](#requirement\_terraform) | >= 1.3.1 | | [aws](#requirement\_aws) | >= 4.10.0 | ## Providers diff --git a/terraform/modules/dynamodb/versions.tf b/terraform/modules/dynamodb/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/dynamodb/versions.tf +++ b/terraform/modules/dynamodb/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/eventbridge/versions.tf b/terraform/modules/eventbridge/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/eventbridge/versions.tf +++ b/terraform/modules/eventbridge/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/lambda/README.md b/terraform/modules/lambda/README.md index f5ddf65..03ccd9a 100644 --- a/terraform/modules/lambda/README.md +++ b/terraform/modules/lambda/README.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | 1.3.4 | +| [terraform](#requirement\_terraform) | >= 1.3.1 | | [aws](#requirement\_aws) | >= 4.10.0 | ## Providers diff --git a/terraform/modules/lambda/versions.tf b/terraform/modules/lambda/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/lambda/versions.tf +++ b/terraform/modules/lambda/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/route53/versions.tf b/terraform/modules/route53/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/route53/versions.tf +++ b/terraform/modules/route53/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/s3/README.md b/terraform/modules/s3/README.md index 6cbefa5..8859fa4 100644 --- a/terraform/modules/s3/README.md +++ b/terraform/modules/s3/README.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | 1.3.4 | +| [terraform](#requirement\_terraform) | >= 1.3.1 | | [aws](#requirement\_aws) | >= 4.10.0 | ## Providers diff --git a/terraform/modules/s3/versions.tf b/terraform/modules/s3/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/s3/versions.tf +++ b/terraform/modules/s3/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/ses/main.tf b/terraform/modules/ses/main.tf deleted file mode 100644 index 4823e50..0000000 --- a/terraform/modules/ses/main.tf +++ /dev/null @@ -1,54 +0,0 @@ -# ------------------------------------------------------------------------------ -# Amazon SES -# ------------------------------------------------------------------------------ - -resource "aws_ses_domain_identity" "this" { - domain = var.domain -} - -resource "aws_ses_domain_mail_from" "this" { - domain = aws_ses_domain_identity.this.domain - mail_from_domain = "mail.${var.domain}" -} - -# hacer for_each - -# resource "aws_route53_record" "amazonses_verification_record" { -# zone_id = data.aws_route53_zone.main.zone_id -# name = "_amazonses.${var.domain}" -# type = "TXT" -# ttl = "600" -# records = [join("", aws_ses_domain_identity.ses_domain.*.verification_token)] -# } - -# resource "aws_ses_domain_dkim" "ses_domain_dkim" { -# domain = join("", aws_ses_domain_identity.ses_domain.*.domain) -# } - -# resource "aws_route53_record" "amazonses_dkim_record" { -# count = 3 -# zone_id = data.aws_route53_zone.main.zone_id -# name = "${element(aws_ses_domain_dkim.ses_domain_dkim.dkim_tokens, count.index)}._domainkey.${var.domain}" -# type = "CNAME" -# ttl = "600" -# records = ["${element(aws_ses_domain_dkim.ses_domain_dkim.dkim_tokens, count.index)}.dkim.amazonses.com"] -# } - -# resource "aws_route53_record" "spf_mail_from" { -# zone_id = data.aws_route53_zone.main.zone_id -# name = aws_ses_domain_mail_from.main.mail_from_domain -# type = "TXT" -# ttl = "600" -# records = ["v=spf1 include:amazonses.com -all"] -# } - -# creo que solo con este spf estamos - -resource "aws_route53_record" "this" { - # zone_id = data.aws_route53_zone.this.zone_id - zone_id = var.zone_id - name = var.domain - type = "TXT" - ttl = "600" - records = ["v=spf1 include:amazonses.com -all"] -} \ No newline at end of file diff --git a/terraform/modules/ses/variables.tf b/terraform/modules/ses/variables.tf deleted file mode 100644 index f881ec7..0000000 --- a/terraform/modules/ses/variables.tf +++ /dev/null @@ -1,13 +0,0 @@ -# ------------------------------------------------------------------------------ -# Amazon SES variables -# ------------------------------------------------------------------------------ - -variable "domain" { - description = "The domain to use." - type = string -} - -variable "zone_id" { - description = "ID of DNS zone" - type = string -} diff --git a/terraform/modules/ses/versions.tf b/terraform/modules/ses/versions.tf deleted file mode 100644 index 3861683..0000000 --- a/terraform/modules/ses/versions.tf +++ /dev/null @@ -1,10 +0,0 @@ -terraform { - required_version = "1.3.4" - - required_providers { - aws = { - source = "hashicorp/aws" - version = ">= 4.10.0" - } - } -} diff --git a/terraform/modules/sns/versions.tf b/terraform/modules/sns/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/sns/versions.tf +++ b/terraform/modules/sns/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/sqs/README.md b/terraform/modules/sqs/README.md index b3d8f56..7442f48 100644 --- a/terraform/modules/sqs/README.md +++ b/terraform/modules/sqs/README.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | 1.3.4 | +| [terraform](#requirement\_terraform) | >= 1.3.1 | | [aws](#requirement\_aws) | >= 4.10.0 | ## Providers diff --git a/terraform/modules/sqs/versions.tf b/terraform/modules/sqs/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/sqs/versions.tf +++ b/terraform/modules/sqs/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/modules/waf/README.md b/terraform/modules/waf/README.md index 78a0bbf..e24b407 100644 --- a/terraform/modules/waf/README.md +++ b/terraform/modules/waf/README.md @@ -3,7 +3,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | 1.3.4 | +| [terraform](#requirement\_terraform) | >= 1.3.1 | | [aws](#requirement\_aws) | >= 4.10.0 | ## Providers diff --git a/terraform/modules/waf/versions.tf b/terraform/modules/waf/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/modules/waf/versions.tf +++ b/terraform/modules/waf/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = { diff --git a/terraform/organization/backup.tf b/terraform/organization/backup.tf deleted file mode 100644 index c0e305a..0000000 --- a/terraform/organization/backup.tf +++ /dev/null @@ -1,32 +0,0 @@ -module "backup" { - source = "../modules/backup" - - providers = { - aws = aws.aws - } - - vault_name = "dynamodb-backup-vault" - plan_name = "dynamodb-backup-plan" - - rules = [ - { - name = "dynamodb-backup-rule" - schedule = "cron(0 12 * * ? *)" - target_vault_name = "dynamodb-backup-vault" - start_window = 120 - completion_window = 360 - enable_continuous_backup = true - lifecycle = { - cold_storage_after = 0 - delete_after = 30 - }, - } - ] - - selections = [ - { - name = "selection" - resources = ["arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/${module.dynamodb.name}"] - } - ] -} diff --git a/terraform/organization/ses.tf b/terraform/organization/ses.tf deleted file mode 100644 index 1c18156..0000000 --- a/terraform/organization/ses.tf +++ /dev/null @@ -1,14 +0,0 @@ -module "ses" { - source = "../modules/ses" - - providers = { - aws = aws.aws - } - - depends_on = [ - module.route53 - ] - - domain = local.domain - zone_id = module.route53.zone_id -} diff --git a/terraform/organization/versions.tf b/terraform/organization/versions.tf index 3861683..d4ef3d7 100644 --- a/terraform/organization/versions.tf +++ b/terraform/organization/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "1.3.4" + required_version = ">= 1.3.1" required_providers { aws = {