Initial migration (#1)
This will be needed to make the initial tags. Once merged to main, I will tag with the same module revisions as what exists in the Fleet repo. We can then test the example module using the new settings. Once validated, we'll then update the main fleet repo to redirect here for /terraform and remove everything there. Anything referring to old tags will still work in-place. Additionally any website references will be updated as well to reflect these changes.
This commit is contained in:
1 parent
ab9ac9862e
commit
f378f62db2
186 files changed
+9900
-3
No files matched your search
@@ -0,0 +1,2 @@
|
||||
# SES Mailing Addon
|
||||
This addon allows Fleet to send password resets via SES
|
||||
@@ -0,0 +1 @@
|
||||
header-from: .header.md
|
||||
@@ -0,0 +1,42 @@
|
||||
# SES Mailing Addon
|
||||
This addon allows Fleet to send password resets via SES
|
||||
|
||||
## Requirements
|
||||
|
||||
No requirements.
|
||||
|
||||
## Providers
|
||||
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.62.2 |
|
||||
|
||||
## Modules
|
||||
|
||||
No modules.
|
||||
|
||||
## Resources
|
||||
|
||||
| Name | Type |
|
||||
|------|------|
|
||||
| [aws_iam_policy.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
|
||||
| [aws_route53_record.amazonses_dkim_record](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
|
||||
| [aws_route53_record.spf_domain](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
|
||||
| [aws_ses_domain_dkim.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ses_domain_dkim) | resource |
|
||||
| [aws_ses_domain_identity.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ses_domain_identity) | resource |
|
||||
| [aws_iam_policy_document.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|------|---------|:--------:|
|
||||
| <a name="input_domain"></a> [domain](#input\_domain) | Domain to use for SES. | `string` | n/a | yes |
|
||||
| <a name="input_extra_txt_records"></a> [extra\_txt\_records](#input\_extra\_txt\_records) | Extra TXT records that have to match the same name as the Fleet instance | `list(string)` | `[]` | no |
|
||||
| <a name="input_zone_id"></a> [zone\_id](#input\_zone\_id) | Route53 Zone ID | `string` | n/a | yes |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| <a name="output_fleet_extra_environment_variables"></a> [fleet\_extra\_environment\_variables](#output\_fleet\_extra\_environment\_variables) | n/a |
|
||||
| <a name="output_fleet_extra_iam_policies"></a> [fleet\_extra\_iam\_policies](#output\_fleet\_extra\_iam\_policies) | n/a |
|
||||
@@ -0,0 +1,56 @@
|
||||
locals {
|
||||
spf_domains = [
|
||||
aws_ses_domain_identity.default.domain,
|
||||
"_amazonses.${aws_ses_domain_identity.default.domain}"
|
||||
]
|
||||
}
|
||||
|
||||
resource "aws_ses_domain_identity" "default" {
|
||||
domain = var.domain
|
||||
}
|
||||
|
||||
resource "aws_ses_domain_dkim" "default" {
|
||||
domain = aws_ses_domain_identity.default.domain
|
||||
}
|
||||
|
||||
###DKIM VERIFICATION#######
|
||||
|
||||
resource "aws_route53_record" "amazonses_dkim_record" {
|
||||
count = 3 // no clue why this is three, but multiple modules all did the same thing
|
||||
zone_id = var.zone_id
|
||||
name = "${element(aws_ses_domain_dkim.default.dkim_tokens, count.index)}._domainkey.${var.domain}"
|
||||
type = "CNAME"
|
||||
ttl = "600"
|
||||
records = ["${element(aws_ses_domain_dkim.default.dkim_tokens, count.index)}.dkim.amazonses.com"]
|
||||
}
|
||||
|
||||
|
||||
resource "aws_route53_record" "spf_domain" {
|
||||
for_each = toset(local.spf_domains)
|
||||
zone_id = var.zone_id
|
||||
name = each.key
|
||||
type = "TXT"
|
||||
ttl = "600"
|
||||
records = each.key == aws_ses_domain_identity.default.domain ? flatten([["v=spf1 include:amazonses.com -all"], var.extra_txt_records]) : ["v=spf1 include:amazonses.com -all"]
|
||||
}
|
||||
|
||||
resource "aws_iam_policy" "main" {
|
||||
policy = data.aws_iam_policy_document.main.json
|
||||
}
|
||||
|
||||
data "aws_iam_policy_document" "main" {
|
||||
statement {
|
||||
actions = [
|
||||
"ses:SendEmail",
|
||||
"ses:SendRawEmail",
|
||||
]
|
||||
resources = ["*"]
|
||||
condition {
|
||||
test = "StringLike"
|
||||
variable = "ses:FromAddress"
|
||||
values = [
|
||||
"*@${var.domain}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
output "fleet_extra_environment_variables" {
|
||||
value = {
|
||||
FLEET_EMAIL_BACKEND = "ses"
|
||||
FLEET_SES_SOURCE_ARN = aws_ses_domain_identity.default.arn
|
||||
}
|
||||
}
|
||||
|
||||
output "fleet_extra_iam_policies" {
|
||||
value = [
|
||||
aws_iam_policy.main.arn
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
variable "domain" {
|
||||
type = string
|
||||
description = "Domain to use for SES."
|
||||
}
|
||||
|
||||
variable "zone_id" {
|
||||
type = string
|
||||
description = "Route53 Zone ID"
|
||||
}
|
||||
|
||||
variable "extra_txt_records" {
|
||||
type = list(string)
|
||||
description = "Extra TXT records that have to match the same name as the Fleet instance"
|
||||
default = []
|
||||
}
|
||||
Reference in new issue
Block a user