diff --git a/README.md b/README.md index fe794a0..46c24ed 100644 --- a/README.md +++ b/README.md @@ -182,13 +182,14 @@ Edit `.header.md`, run `terraform init`, then run `terraform-docs markdown . > R | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [terraform](#requirement\_terraform) | >= 1.12.0 | +| [aws](#requirement\_aws) | >= 6.37.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | 6.35.1 | +| [aws](#provider\_aws) | 6.37.0 | ## Modules @@ -215,7 +216,7 @@ Edit `.header.md`, run `terraform init`, then run `terraform-docs markdown . > R | [alb\_config](#input\_alb\_config) | n/a |
object({
name = optional(string, "fleet")
security_groups = optional(list(string), [])
access_logs = optional(map(string), {})
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
egress_ipv6_cidrs = optional(list(string), ["::/0"])
fleet_target_group = optional(object({
protocol = optional(string, "HTTP")
port = optional(number, 80)
target_type = optional(string, "ip")
create_attachment = optional(bool, false)
health_check = optional(object({
path = optional(string, "/healthz")
matcher = optional(string, "200")
port = optional(string)
timeout = optional(number, 10)
interval = optional(number, 15)
healthy_threshold = optional(number, 5)
unhealthy_threshold = optional(number, 5)
}), {})
}), {})
extra_target_groups = optional(any, [])
https_listener_rules = optional(any, [])
https_overrides = optional(any, {})
xff_header_processing_mode = optional(string, null)
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
idle_timeout = optional(number, 905)
internal = optional(bool, false)
enable_deletion_protection = optional(bool, false)
})
| `{}` | no | | [certificate\_arn](#input\_certificate\_arn) | n/a | `string` | n/a | yes | | [ecs\_cluster](#input\_ecs\_cluster) | The config for the terraform-aws-modules/ecs/aws module. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
autoscaling_capacity_providers = optional(any, {})
cluster_configuration = optional(any, {
execute_command_configuration = {
logging = "OVERRIDE"
log_configuration = {
cloud_watch_log_group_name = "/aws/ecs/aws-ec2"
}
}
})
cluster_name = optional(string, "fleet")
cloudwatch_log_group = optional(object({
create = optional(bool, true)
retention_in_days = optional(number, 90)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-ecs-cluster-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
extra_kms_policies = []
})
}), {
create = true
retention_in_days = 90
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
}
})
cluster_settings = optional(any, {
"name" : "containerInsights",
"value" : "enabled",
})
create = optional(bool, true)
default_capacity_provider_use_fargate = optional(bool, true)
fargate_capacity_providers = optional(any, {
FARGATE = {
default_capacity_provider_strategy = {
weight = 100
}
}
FARGATE_SPOT = {
default_capacity_provider_strategy = {
weight = 0
}
}
})
tags = optional(map(string))
})
|
{
"autoscaling_capacity_providers": {},
"cloudwatch_log_group": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-ecs-cluster-logs",
"kms_key_arn": null
},
"retention_in_days": 90
},
"cluster_configuration": {
"execute_command_configuration": {
"log_configuration": {
"cloud_watch_log_group_name": "/aws/ecs/aws-ec2"
},
"logging": "OVERRIDE"
}
},
"cluster_name": "fleet",
"cluster_settings": {
"name": "containerInsights",
"value": "enabled"
},
"create": true,
"default_capacity_provider_use_fargate": true,
"fargate_capacity_providers": {
"FARGATE": {
"default_capacity_provider_strategy": {
"weight": 100
}
},
"FARGATE_SPOT": {
"default_capacity_provider_strategy": {
"weight": 0
}
}
},
"tags": {}
}
| no | -| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
image = optional(string, "fleetdm/fleet:v4.81.2")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
extra_kms_policies = []
})
fargate_ephemeral_storage_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-fargate-ephemeral-storage")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-fargate-ephemeral-storage"
extra_kms_policies = []
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = optional(object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
}), {
password_secret_arn = null
password_secret_kms_key_arn = null
user = null
database = null
address = null
rr_address = null
})
redis = optional(object({
address = string
use_tls = optional(bool, true)
}), {
address = null
use_tls = true
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
}
})
loadbalancer = optional(object({
arn = string
}), {
arn = null
})
extra_load_balancers = optional(list(any), [])
networking = optional(object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = optional(object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
}), {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
})
assign_public_ip = optional(bool, false)
}), {
subnets = null
security_groups = null
ingress_sources = {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
}
assign_public_ip = false
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
cloudfront_distribution_arn = optional(string, null)
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
extra_kms_policies = optional(list(any), [])
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
cloudfront_distribution_arn = null
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
extra_kms_policies = []
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"cpu": 512,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"fargate_ephemeral_storage_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-fargate-ephemeral-storage",
"kms_key_arn": null
},
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.81.2",
"loadbalancer": {
"arn": null
},
"mem": 4096,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"security_groups": null,
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"cloudfront_distribution_arn": null,
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"extra_kms_policies": [],
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | +| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
command = optional(list(string), null)
private_key_delivery_method = optional(string, "ecs")
image = optional(string, "fleetdm/fleet:v4.83.0")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_arn = optional(string, null)
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
extra_kms_policies = []
})
fargate_ephemeral_storage_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-fargate-ephemeral-storage")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-fargate-ephemeral-storage"
extra_kms_policies = []
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = optional(object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
}), {
password_secret_arn = null
password_secret_kms_key_arn = null
user = null
database = null
address = null
rr_address = null
})
redis = optional(object({
address = string
use_tls = optional(bool, true)
}), {
address = null
use_tls = true
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
}
})
loadbalancer = optional(object({
arn = string
}), {
arn = null
})
extra_load_balancers = optional(list(any), [])
networking = optional(object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = optional(object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
}), {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
})
assign_public_ip = optional(bool, false)
}), {
subnets = null
security_groups = null
ingress_sources = {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
}
assign_public_ip = false
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
cloudfront_distribution_arn = optional(string, null)
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
extra_kms_policies = optional(list(any), [])
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
cloudfront_distribution_arn = null
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
extra_kms_policies = []
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"command": null,
"cpu": 512,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"fargate_ephemeral_storage_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-fargate-ephemeral-storage",
"kms_key_arn": null
},
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.83.0",
"loadbalancer": {
"arn": null
},
"mem": 4096,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_delivery_method": "ecs",
"private_key_secret_arn": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"security_groups": null,
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"cloudfront_distribution_arn": null,
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"extra_kms_policies": [],
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | | [kms\_base\_policy](#input\_kms\_base\_policy) | Optional base KMS key-policy statements to apply to module-created CMKs before module-required service access statements are merged in. If null, the module defaults to the historical root `kms:*` statement. |
list(object({
sid = string
effect = string
principals = object({
type = string
identifiers = list(string)
})
actions = list(string)
resources = list(string)
conditions = optional(list(object({
test = string
variable = string
values = list(string)
})), [])
}))
| `null` | no | | [migration\_config](#input\_migration\_config) | The configuration object for Fleet's migration task. |
object({
mem = number
cpu = number
})
|
{
"cpu": 1024,
"mem": 2048
}
| no | | [rds\_config](#input\_rds\_config) | The config for the terraform-aws-modules/rds-aurora/aws module |
object({
name = optional(string, "fleet")
engine_version = optional(string, "8.0.mysql_aurora.3.08.2")
instance_class = optional(string, "db.t4g.large")
subnets = optional(list(string), [])
allowed_security_groups = optional(list(string), [])
allowed_cidr_blocks = optional(list(string), [])
apply_immediately = optional(bool, true)
monitoring_interval = optional(number, 10)
backtrack_window = optional(number, null)
db_parameter_group_name = optional(string)
db_parameters = optional(map(string), {})
db_cluster_parameter_group_name = optional(string)
db_cluster_parameters = optional(map(string), {})
enabled_cloudwatch_logs_exports = optional(list(string), [])
final_snapshot_identifier = optional(string, null)
password_secret_kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-password-secret")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-password-secret"
extra_kms_policies = []
})
storage_kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-storage")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-storage"
extra_kms_policies = []
})
observability = optional(object({
performance_insights_enabled = optional(bool, true)
retention_period = optional(number, null)
database_insights_mode = optional(string, null)
kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-performance-insights")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-performance-insights"
extra_kms_policies = []
})
}), {
performance_insights_enabled = true
retention_period = null
database_insights_mode = null
kms = {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-performance-insights"
extra_kms_policies = []
}
})
cloudwatch_log_group = optional(object({
retention_in_days = optional(number, null)
skip_destroy = optional(bool, false)
kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-logs"
extra_kms_policies = []
})
}), {
retention_in_days = null
skip_destroy = false
kms = {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-logs"
extra_kms_policies = []
}
})
master_username = optional(string, "fleet")
snapshot_identifier = optional(string)
cluster_tags = optional(map(string), {})
skip_final_snapshot = optional(bool, true)
backup_retention_period = optional(number, 7)
replicas = optional(number, 2)
serverless = optional(bool, false)
serverless_min_capacity = optional(number, 2)
serverless_max_capacity = optional(number, 10)
restore_to_point_in_time = optional(map(string), {})
})
|
{
"allowed_cidr_blocks": [],
"allowed_security_groups": [],
"apply_immediately": true,
"backtrack_window": null,
"backup_retention_period": 7,
"cloudwatch_log_group": {
"kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-logs",
"kms_key_arn": null
},
"retention_in_days": null,
"skip_destroy": false
},
"cluster_tags": {},
"db_cluster_parameter_group_name": null,
"db_cluster_parameters": {},
"db_parameter_group_name": null,
"db_parameters": {},
"enabled_cloudwatch_logs_exports": [],
"engine_version": "8.0.mysql_aurora.3.08.2",
"final_snapshot_identifier": null,
"instance_class": "db.t4g.large",
"master_username": "fleet",
"monitoring_interval": 10,
"name": "fleet",
"observability": {
"database_insights_mode": null,
"kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-performance-insights",
"kms_key_arn": null
},
"performance_insights_enabled": true,
"retention_period": null
},
"password_secret_kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-password-secret",
"kms_key_arn": null
},
"replicas": 2,
"restore_to_point_in_time": {},
"serverless": false,
"serverless_max_capacity": 10,
"serverless_min_capacity": 2,
"skip_final_snapshot": true,
"snapshot_identifier": null,
"storage_kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-storage",
"kms_key_arn": null
},
"subnets": []
}
| no | diff --git a/addons/external-vuln-scans/main.tf b/addons/external-vuln-scans/main.tf index 61363bf..6c901bc 100644 --- a/addons/external-vuln-scans/main.tf +++ b/addons/external-vuln-scans/main.tf @@ -16,8 +16,9 @@ locals { for k, v in merge(var.fleet_config.extra_secrets, { FLEET_MYSQL_PASSWORD = var.fleet_config.database.password_secret_arn FLEET_MYSQL_READ_REPLICA_PASSWORD = var.fleet_config.database.password_secret_arn - FLEET_SERVER_PRIVATE_KEY = var.fleet_server_private_key_secret_arn - }) : { + }, var.fleet_config.private_key_delivery_method == "ecs" ? { + FLEET_SERVER_PRIVATE_KEY = var.fleet_server_private_key_secret_arn + } : {}) : { name = k valueFrom = v } @@ -59,79 +60,87 @@ resource "aws_ecs_task_definition" "vuln-processing" { requires_compatibilities = ["FARGATE"] container_definitions = jsonencode(concat([ - { - name = "fleet-vuln-processing" - image = var.fleet_config.image - cpu = var.vuln_processing_cpu - memory = var.vuln_processing_memory - essential = true - networkMode = "awsvpc" - secrets = local.secrets - repositoryCredentials = local.repository_credentials - mountPoints = var.fleet_config.mount_points - dependsOn = var.fleet_config.depends_on - ulimits = [ - { - name = "nofile" - softLimit = 999999 - hardLimit = 999999 + merge( + { + name = "fleet-vuln-processing" + image = var.fleet_config.image + cpu = var.vuln_processing_cpu + memory = var.vuln_processing_memory + essential = true + networkMode = "awsvpc" + secrets = local.secrets + repositoryCredentials = local.repository_credentials + mountPoints = var.fleet_config.mount_points + dependsOn = var.fleet_config.depends_on + ulimits = [ + { + name = "nofile" + softLimit = 999999 + hardLimit = 999999 + } + ] + environment = concat([ + { + name = "FLEET_MYSQL_USERNAME" + value = var.fleet_config.database.user + }, + { + name = "FLEET_MYSQL_DATABASE" + value = var.fleet_config.database.database + }, + { + name = "FLEET_MYSQL_ADDRESS" + value = var.fleet_config.database.address + }, + { + name = "FLEET_MYSQL_READ_REPLICA_USERNAME" + value = var.fleet_config.database.user + }, + { + name = "FLEET_MYSQL_READ_REPLICA_DATABASE" + value = var.fleet_config.database.database + }, + { + name = "FLEET_MYSQL_READ_REPLICA_ADDRESS" + value = var.fleet_config.database.rr_address == null ? var.fleet_config.database.address : var.fleet_config.database.rr_address + }, + { + name = "FLEET_REDIS_ADDRESS" + value = var.fleet_config.redis.address + }, + { + name = "FLEET_REDIS_USE_TLS" + value = tostring(var.fleet_config.redis.use_tls) + }, + { + name = "FLEET_SERVER_TLS" + value = tostring(try(var.fleet_config.server_tls_enabled, false)) + }, + { + name = "FLEET_S3_SOFTWARE_INSTALLERS_BUCKET" + value = var.fleet_s3_software_installers_config.bucket_name + }, + { + name = "FLEET_S3_SOFTWARE_INSTALLERS_PREFIX" + value = var.fleet_s3_software_installers_config.s3_object_prefix + } + ], var.fleet_config.private_key_delivery_method == "iam" ? [{ + name = "FLEET_SERVER_PRIVATE_KEY_ARN" + value = var.fleet_server_private_key_secret_arn + }] : [], local.environment) + logConfiguration = { + logDriver = "awslogs" + options = { + awslogs-group = var.awslogs_config.group + awslogs-region = var.awslogs_config.region == null ? data.aws_region.current.region : var.awslogs_config.region + awslogs-stream-prefix = "${var.awslogs_config.prefix}-vuln-processing" + } } - ], - environment = concat([ - { - name = "FLEET_MYSQL_USERNAME" - value = var.fleet_config.database.user - }, - { - name = "FLEET_MYSQL_DATABASE" - value = var.fleet_config.database.database - }, - { - name = "FLEET_MYSQL_ADDRESS" - value = var.fleet_config.database.address - }, - { - name = "FLEET_MYSQL_READ_REPLICA_USERNAME" - value = var.fleet_config.database.user - }, - { - name = "FLEET_MYSQL_READ_REPLICA_DATABASE" - value = var.fleet_config.database.database - }, - { - name = "FLEET_MYSQL_READ_REPLICA_ADDRESS" - value = var.fleet_config.database.rr_address == null ? var.fleet_config.database.address : var.fleet_config.database.rr_address - }, - { - name = "FLEET_REDIS_ADDRESS" - value = var.fleet_config.redis.address - }, - { - name = "FLEET_REDIS_USE_TLS" - value = tostring(var.fleet_config.redis.use_tls) - }, - { - name = "FLEET_SERVER_TLS" - value = tostring(try(var.fleet_config.server_tls_enabled, false)) - }, - { - name = "FLEET_S3_SOFTWARE_INSTALLERS_BUCKET" - value = var.fleet_s3_software_installers_config.bucket_name - }, - { - name = "FLEET_S3_SOFTWARE_INSTALLERS_PREFIX" - value = var.fleet_s3_software_installers_config.s3_object_prefix - }, - ], local.environment), - logConfiguration = { - logDriver = "awslogs" - options = { - awslogs-group = var.awslogs_config.group - awslogs-region = var.awslogs_config.region == null ? data.aws_region.current.region : var.awslogs_config.region - awslogs-stream-prefix = "${var.awslogs_config.prefix}-vuln-processing" - } - } - }] + }, + var.fleet_config.command != null ? { + command = var.fleet_config.command + } : {} + )] , var.fleet_config.sidecars)) dynamic "volume" { @@ -162,4 +171,3 @@ resource "aws_ecs_task_definition" "vuln-processing" { } } - diff --git a/byo-vpc/README.md b/byo-vpc/README.md index 1ffbb85..845e85f 100644 --- a/byo-vpc/README.md +++ b/byo-vpc/README.md @@ -316,14 +316,14 @@ Edit `.header.md`, run `terraform init`, then run `terraform-docs markdown --hea | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.5.0 | -| [aws](#requirement\_aws) | >= 5.73.0 | +| [terraform](#requirement\_terraform) | >= 1.12.0 | +| [aws](#requirement\_aws) | >= 6.37.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | 6.35.1 | +| [aws](#provider\_aws) | 6.38.0 | | [random](#provider\_random) | 3.8.1 | ## Modules @@ -372,7 +372,7 @@ Edit `.header.md`, run `terraform init`, then run `terraform-docs markdown --hea |------|-------------|------|---------|:--------:| | [alb\_config](#input\_alb\_config) | n/a |
object({
name = optional(string, "fleet")
subnets = list(string)
security_groups = optional(list(string), [])
access_logs = optional(map(string), {})
certificate_arn = string
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
egress_ipv6_cidrs = optional(list(string), ["::/0"])
fleet_target_group = optional(object({
protocol = optional(string, "HTTP")
port = optional(number, 80)
target_type = optional(string, "ip")
create_attachment = optional(bool, false)
health_check = optional(object({
path = optional(string, "/healthz")
matcher = optional(string, "200")
port = optional(string)
timeout = optional(number, 10)
interval = optional(number, 15)
healthy_threshold = optional(number, 5)
unhealthy_threshold = optional(number, 5)
}), {})
}), {})
extra_target_groups = optional(any, [])
https_listener_rules = optional(any, [])
https_overrides = optional(any, {})
xff_header_processing_mode = optional(string, null)
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
idle_timeout = optional(number, 905)
internal = optional(bool, false)
enable_deletion_protection = optional(bool, false)
})
| n/a | yes | | [ecs\_cluster](#input\_ecs\_cluster) | The config for the terraform-aws-modules/ecs/aws module. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
autoscaling_capacity_providers = optional(any, {})
cluster_configuration = optional(any, {
execute_command_configuration = {
logging = "OVERRIDE"
log_configuration = {
cloud_watch_log_group_name = "/aws/ecs/aws-ec2"
}
}
})
cluster_name = optional(string, "fleet")
cloudwatch_log_group = optional(object({
create = optional(bool, true)
retention_in_days = optional(number, 90)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-ecs-cluster-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
extra_kms_policies = []
})
}), {
create = true
retention_in_days = 90
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
extra_kms_policies = []
}
})
cluster_settings = optional(any, {
"name" : "containerInsights",
"value" : "enabled",
})
create = optional(bool, true)
default_capacity_provider_use_fargate = optional(bool, true)
fargate_capacity_providers = optional(any, {
FARGATE = {
default_capacity_provider_strategy = {
weight = 100
}
}
FARGATE_SPOT = {
default_capacity_provider_strategy = {
weight = 0
}
}
})
tags = optional(map(string))
})
|
{
"autoscaling_capacity_providers": {},
"cloudwatch_log_group": {
"create": true,
"kms": {
"cmk_enabled": false,
"kms_alias": "fleet-ecs-cluster-logs",
"kms_key_arn": null
},
"retention_in_days": 90
},
"cluster_configuration": {
"execute_command_configuration": {
"log_configuration": {
"cloud_watch_log_group_name": "/aws/ecs/aws-ec2"
},
"logging": "OVERRIDE"
}
},
"cluster_name": "fleet",
"cluster_settings": {
"name": "containerInsights",
"value": "enabled"
},
"create": true,
"default_capacity_provider_use_fargate": true,
"fargate_capacity_providers": {
"FARGATE": {
"default_capacity_provider_strategy": {
"weight": 100
}
},
"FARGATE_SPOT": {
"default_capacity_provider_strategy": {
"weight": 0
}
}
},
"tags": {}
}
| no | -| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
image = optional(string, "fleetdm/fleet:v4.81.2")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
extra_kms_policies = []
})
fargate_ephemeral_storage_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-fargate-ephemeral-storage")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-fargate-ephemeral-storage"
extra_kms_policies = []
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = optional(object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
}), {
password_secret_arn = null
password_secret_kms_key_arn = null
user = null
database = null
address = null
rr_address = null
})
redis = optional(object({
address = string
use_tls = optional(bool, true)
}), {
address = null
use_tls = true
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
}
})
loadbalancer = optional(object({
arn = string
}), {
arn = null
})
extra_load_balancers = optional(list(any), [])
networking = optional(object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = optional(object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
}), {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
})
assign_public_ip = optional(bool, false)
}), {
subnets = null
security_groups = null
ingress_sources = {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
}
assign_public_ip = false
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
cloudfront_distribution_arn = optional(string, null)
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
extra_kms_policies = optional(list(any), [])
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
cloudfront_distribution_arn = null
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
extra_kms_policies = []
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"cpu": 512,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"fargate_ephemeral_storage_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-fargate-ephemeral-storage",
"kms_key_arn": null
},
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.81.2",
"loadbalancer": {
"arn": null
},
"mem": 4096,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"security_groups": null,
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"cloudfront_distribution_arn": null,
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"extra_kms_policies": [],
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | +| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
command = optional(list(string), null)
private_key_delivery_method = optional(string, "ecs")
image = optional(string, "fleetdm/fleet:v4.83.0")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_arn = optional(string, null)
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
extra_kms_policies = []
})
fargate_ephemeral_storage_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-fargate-ephemeral-storage")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-fargate-ephemeral-storage"
extra_kms_policies = []
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = optional(object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
}), {
password_secret_arn = null
password_secret_kms_key_arn = null
user = null
database = null
address = null
rr_address = null
})
redis = optional(object({
address = string
use_tls = optional(bool, true)
}), {
address = null
use_tls = true
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
}
})
loadbalancer = optional(object({
arn = string
}), {
arn = null
})
extra_load_balancers = optional(list(any), [])
networking = optional(object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = optional(object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
}), {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
})
assign_public_ip = optional(bool, false)
}), {
subnets = null
security_groups = null
ingress_sources = {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
}
assign_public_ip = false
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
cloudfront_distribution_arn = optional(string, null)
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
extra_kms_policies = optional(list(any), [])
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
cloudfront_distribution_arn = null
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
extra_kms_policies = []
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"command": null,
"cpu": 512,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"fargate_ephemeral_storage_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-fargate-ephemeral-storage",
"kms_key_arn": null
},
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.83.0",
"loadbalancer": {
"arn": null
},
"mem": 4096,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_delivery_method": "ecs",
"private_key_secret_arn": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"security_groups": null,
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"cloudfront_distribution_arn": null,
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"extra_kms_policies": [],
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | | [kms\_base\_policy](#input\_kms\_base\_policy) | Optional base KMS key-policy statements to apply to module-created CMKs before module-required service access statements are merged in. If null, the module defaults to the historical root `kms:*` statement. |
list(object({
sid = string
effect = string
principals = object({
type = string
identifiers = list(string)
})
actions = list(string)
resources = list(string)
conditions = optional(list(object({
test = string
variable = string
values = list(string)
})), [])
}))
| `null` | no | | [migration\_config](#input\_migration\_config) | The configuration object for Fleet's migration task. |
object({
mem = number
cpu = number
})
|
{
"cpu": 1024,
"mem": 2048
}
| no | | [rds\_config](#input\_rds\_config) | The config for the terraform-aws-modules/rds-aurora/aws module |
object({
name = optional(string, "fleet")
engine_version = optional(string, "8.0.mysql_aurora.3.07.1")
instance_class = optional(string, "db.t4g.large")
subnets = optional(list(string), [])
allowed_security_groups = optional(list(string), [])
allowed_cidr_blocks = optional(list(string), [])
apply_immediately = optional(bool, true)
monitoring_interval = optional(number, 10)
backtrack_window = optional(number, null)
db_parameter_group_name = optional(string)
db_parameters = optional(map(string), {})
db_cluster_parameter_group_name = optional(string)
db_cluster_parameters = optional(map(string), {})
enabled_cloudwatch_logs_exports = optional(list(string), [])
final_snapshot_identifier = optional(string, null)
password_secret_kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-password-secret")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-password-secret"
extra_kms_policies = []
})
storage_kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-storage")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-storage"
extra_kms_policies = []
})
observability = optional(object({
performance_insights_enabled = optional(bool, true)
retention_period = optional(number, null)
database_insights_mode = optional(string, null)
kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-performance-insights")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-performance-insights"
extra_kms_policies = []
})
}), {
performance_insights_enabled = true
retention_period = null
database_insights_mode = null
kms = {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-performance-insights"
extra_kms_policies = []
}
})
cloudwatch_log_group = optional(object({
retention_in_days = optional(number, null)
skip_destroy = optional(bool, false)
kms = optional(object({
cmk_enabled = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-rds-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-logs"
extra_kms_policies = []
})
}), {
retention_in_days = null
skip_destroy = false
kms = {
cmk_enabled = false
kms_key_arn = null
kms_alias = "fleet-rds-logs"
extra_kms_policies = []
}
})
master_username = optional(string, "fleet")
snapshot_identifier = optional(string)
cluster_tags = optional(map(string), {})
preferred_maintenance_window = optional(string, "thu:23:00-fri:00:00")
skip_final_snapshot = optional(bool, true)
backup_retention_period = optional(number, 7)
replicas = optional(number, 2)
serverless = optional(bool, false)
serverless_min_capacity = optional(number, 2)
serverless_max_capacity = optional(number, 10)
restore_to_point_in_time = optional(map(string), {})
})
|
{
"allowed_cidr_blocks": [],
"allowed_security_groups": [],
"apply_immediately": true,
"backtrack_window": null,
"backup_retention_period": 7,
"cloudwatch_log_group": {
"kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-logs",
"kms_key_arn": null
},
"retention_in_days": null,
"skip_destroy": false
},
"cluster_tags": {},
"db_cluster_parameter_group_name": null,
"db_cluster_parameters": {},
"db_parameter_group_name": null,
"db_parameters": {},
"enabled_cloudwatch_logs_exports": [],
"engine_version": "8.0.mysql_aurora.3.07.1",
"final_snapshot_identifier": null,
"instance_class": "db.t4g.large",
"master_username": "fleet",
"monitoring_interval": 10,
"name": "fleet",
"observability": {
"database_insights_mode": null,
"kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-performance-insights",
"kms_key_arn": null
},
"performance_insights_enabled": true,
"retention_period": null
},
"password_secret_kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-password-secret",
"kms_key_arn": null
},
"preferred_maintenance_window": "thu:23:00-fri:00:00",
"replicas": 2,
"restore_to_point_in_time": {},
"serverless": false,
"serverless_max_capacity": 10,
"serverless_min_capacity": 2,
"skip_final_snapshot": true,
"snapshot_identifier": null,
"storage_kms": {
"cmk_enabled": false,
"extra_kms_policies": [],
"kms_alias": "fleet-rds-storage",
"kms_key_arn": null
},
"subnets": []
}
| no | diff --git a/byo-vpc/byo-db/README.md b/byo-vpc/byo-db/README.md index 0f7bfbb..db9ad00 100644 --- a/byo-vpc/byo-db/README.md +++ b/byo-vpc/byo-db/README.md @@ -2,13 +2,14 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [terraform](#requirement\_terraform) | >= 1.12.0 | +| [aws](#requirement\_aws) | >= 6.37.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | 6.35.1 | +| [aws](#provider\_aws) | 6.38.0 | ## Modules @@ -38,8 +39,8 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [alb\_config](#input\_alb\_config) | n/a |
object({
name = optional(string, "fleet")
subnets = list(string)
security_groups = optional(list(string), [])
access_logs = optional(map(string), {})
certificate_arn = string
allowed_cidrs = optional(list(string), ["0.0.0.0/0"])
allowed_ipv6_cidrs = optional(list(string), ["::/0"])
egress_cidrs = optional(list(string), ["0.0.0.0/0"])
egress_ipv6_cidrs = optional(list(string), ["::/0"])
fleet_target_group = optional(object({
protocol = optional(string, "HTTP")
port = optional(number, 80)
target_type = optional(string, "ip")
create_attachment = optional(bool, false)
health_check = optional(object({
path = optional(string, "/healthz")
matcher = optional(string, "200")
port = optional(string)
timeout = optional(number, 10)
interval = optional(number, 15)
healthy_threshold = optional(number, 5)
unhealthy_threshold = optional(number, 5)
}), {})
}), {})
extra_target_groups = optional(any, [])
https_listener_rules = optional(any, [])
https_overrides = optional(any, {})
xff_header_processing_mode = optional(string, null)
tls_policy = optional(string, "ELBSecurityPolicy-TLS13-1-2-2021-06")
idle_timeout = optional(number, 905)
internal = optional(bool, false)
enable_deletion_protection = optional(bool, false)
})
| n/a | yes | -| [ecs\_cluster](#input\_ecs\_cluster) | The config for the terraform-aws-modules/ecs/aws module. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
autoscaling_capacity_providers = optional(any, {})
cluster_configuration = optional(any, {
execute_command_configuration = {
logging = "OVERRIDE"
log_configuration = {
cloud_watch_log_group_name = "/aws/ecs/aws-ec2"
}
}
})
cluster_name = optional(string, "fleet")
cloudwatch_log_group = optional(object({
create = optional(bool, true)
retention_in_days = optional(number, 90)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-ecs-cluster-logs")
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
})
}), {
create = true
retention_in_days = 90
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
}
})
cluster_settings = optional(any, {
"name" : "containerInsights",
"value" : "enabled",
})
create = optional(bool, true)
default_capacity_provider_use_fargate = optional(bool, true)
fargate_capacity_providers = optional(any, {
FARGATE = {
default_capacity_provider_strategy = {
weight = 100
}
}
FARGATE_SPOT = {
default_capacity_provider_strategy = {
weight = 0
}
}
})
tags = optional(map(string))
})
|
{
"autoscaling_capacity_providers": {},
"cloudwatch_log_group": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"kms_alias": "fleet-ecs-cluster-logs",
"kms_key_arn": null
},
"retention_in_days": 90
},
"cluster_configuration": {
"execute_command_configuration": {
"log_configuration": {
"cloud_watch_log_group_name": "/aws/ecs/aws-ec2"
},
"logging": "OVERRIDE"
}
},
"cluster_name": "fleet",
"cluster_settings": {
"name": "containerInsights",
"value": "enabled"
},
"create": true,
"default_capacity_provider_use_fargate": true,
"fargate_capacity_providers": {
"FARGATE": {
"default_capacity_provider_strategy": {
"weight": 100
}
},
"FARGATE_SPOT": {
"default_capacity_provider_strategy": {
"weight": 0
}
}
},
"tags": {}
}
| no | -| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
image = optional(string, "fleetdm/fleet:v4.81.2")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
})
fargate_ephemeral_storage_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-fargate-ephemeral-storage")
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-fargate-ephemeral-storage"
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = optional(object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
}), {
password_secret_arn = null
password_secret_kms_key_arn = null
user = null
database = null
address = null
rr_address = null
})
redis = optional(object({
address = string
use_tls = optional(bool, true)
}), {
address = null
use_tls = true
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
}
})
loadbalancer = optional(object({
arn = string
}), {
arn = null
})
extra_load_balancers = optional(list(any), [])
networking = optional(object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = optional(object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
}), {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
})
assign_public_ip = optional(bool, false)
}), {
subnets = null
security_groups = null
ingress_sources = {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
}
assign_public_ip = false
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"cpu": 512,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"fargate_ephemeral_storage_kms": {
"cmk_enabled": null,
"enabled": null,
"kms_alias": "fleet-fargate-ephemeral-storage",
"kms_key_arn": null
},
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.81.2",
"loadbalancer": {
"arn": null
},
"mem": 4096,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"security_groups": null,
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | +| [ecs\_cluster](#input\_ecs\_cluster) | The config for the terraform-aws-modules/ecs/aws module. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
autoscaling_capacity_providers = optional(any, {})
cluster_configuration = optional(any, {
execute_command_configuration = {
logging = "OVERRIDE"
log_configuration = {
cloud_watch_log_group_name = "/aws/ecs/aws-ec2"
}
}
})
cluster_name = optional(string, "fleet")
cloudwatch_log_group = optional(object({
create = optional(bool, true)
retention_in_days = optional(number, 90)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-ecs-cluster-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
extra_kms_policies = []
})
}), {
create = true
retention_in_days = 90
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-ecs-cluster-logs"
extra_kms_policies = []
}
})
cluster_settings = optional(any, {
"name" : "containerInsights",
"value" : "enabled",
})
create = optional(bool, true)
default_capacity_provider_use_fargate = optional(bool, true)
fargate_capacity_providers = optional(any, {
FARGATE = {
default_capacity_provider_strategy = {
weight = 100
}
}
FARGATE_SPOT = {
default_capacity_provider_strategy = {
weight = 0
}
}
})
tags = optional(map(string))
})
|
{
"autoscaling_capacity_providers": {},
"cloudwatch_log_group": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"kms_alias": "fleet-ecs-cluster-logs",
"kms_key_arn": null
},
"retention_in_days": 90
},
"cluster_configuration": {
"execute_command_configuration": {
"log_configuration": {
"cloud_watch_log_group_name": "/aws/ecs/aws-ec2"
},
"logging": "OVERRIDE"
}
},
"cluster_name": "fleet",
"cluster_settings": {
"name": "containerInsights",
"value": "enabled"
},
"create": true,
"default_capacity_provider_use_fargate": true,
"fargate_capacity_providers": {
"FARGATE": {
"default_capacity_provider_strategy": {
"weight": 100
}
},
"FARGATE_SPOT": {
"default_capacity_provider_strategy": {
"weight": 0
}
}
},
"tags": {}
}
| no | +| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
command = optional(list(string), null)
private_key_delivery_method = optional(string, "ecs")
image = optional(string, "fleetdm/fleet:v4.83.0")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_arn = optional(string, null)
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
extra_kms_policies = []
})
fargate_ephemeral_storage_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-fargate-ephemeral-storage")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-fargate-ephemeral-storage"
extra_kms_policies = []
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = optional(object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
}), {
password_secret_arn = null
password_secret_kms_key_arn = null
user = null
database = null
address = null
rr_address = null
})
redis = optional(object({
address = string
use_tls = optional(bool, true)
}), {
address = null
use_tls = true
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
}
})
loadbalancer = optional(object({
arn = string
}), {
arn = null
})
extra_load_balancers = optional(list(any), [])
networking = optional(object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = optional(object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
}), {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
})
assign_public_ip = optional(bool, false)
}), {
subnets = null
security_groups = null
ingress_sources = {
cidr_blocks = []
ipv6_cidr_blocks = []
security_groups = []
prefix_list_ids = []
}
assign_public_ip = false
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
cloudfront_distribution_arn = optional(string, null)
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
extra_kms_policies = optional(list(any), [])
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
cloudfront_distribution_arn = null
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
extra_kms_policies = []
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"command": null,
"cpu": 512,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"fargate_ephemeral_storage_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-fargate-ephemeral-storage",
"kms_key_arn": null
},
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.83.0",
"loadbalancer": {
"arn": null
},
"mem": 4096,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_delivery_method": "ecs",
"private_key_secret_arn": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"cloudfront_distribution_arn": null,
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"extra_kms_policies": [],
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | | [kms\_base\_policy](#input\_kms\_base\_policy) | Optional base KMS key-policy statements to apply to module-created CMKs before module-required service access statements are merged in. If null, the module defaults to the historical root `kms:*` statement. |
list(object({
sid = string
effect = string
principals = object({
type = string
identifiers = list(string)
})
actions = list(string)
resources = list(string)
conditions = optional(list(object({
test = string
variable = string
values = list(string)
})), [])
}))
| `null` | no | | [migration\_config](#input\_migration\_config) | The configuration object for Fleet's migration task. |
object({
mem = number
cpu = number
})
|
{
"cpu": 1024,
"mem": 2048
}
| no | | [vpc\_id](#input\_vpc\_id) | n/a | `string` | n/a | yes | diff --git a/byo-vpc/byo-db/byo-ecs/.header.md b/byo-vpc/byo-db/byo-ecs/.header.md index 032cc52..3e56b98 100644 --- a/byo-vpc/byo-db/byo-ecs/.header.md +++ b/byo-vpc/byo-db/byo-ecs/.header.md @@ -96,9 +96,65 @@ fleet_config = { } ``` +## Command Configuration + +Optionally specify a custom command for the Fleet container: + +```hcl +fleet_config = { + # ... other config ... + command = ["/usr/bin/fleet", "agent", "--some-flag"] +} +``` + +## Private Key Delivery Method + +Control how the Fleet server private key is delivered to the container: + +- **ecs** (default): The secret value is injected as `FLEET_SERVER_PRIVATE_KEY` secret. The ECS Execution Role needs Secrets Manager permissions to decrypt the secret. +- **iam**: The secret ARN is injected as `FLEET_SERVER_PRIVATE_KEY_ARN` environment variable. The Fleet task role needs Secrets Manager permissions to decrypt the secret. + +```hcl +fleet_config = { + # ... other config ... + private_key_delivery_method = "iam" # or "ecs" +} +``` + +When `private_key_delivery_method = "iam"`, the KMS key policy for the private key secret grants decrypt permissions to the Fleet task role instead of the ECS execution role. + +## Caller-Provided Private Key Secret + +By default, this module creates and populates the Fleet server private key secret in Secrets Manager. + +To use a caller-managed existing secret instead, set `fleet_config.private_key_secret_arn`. When this is set: + +- This module does not create the Fleet server private key secret, secret version, or generated random value. +- `fleet_config.private_key_secret_name` is ignored. +- The provided ARN is used in both delivery modes: + - `ecs`: injected as `FLEET_SERVER_PRIVATE_KEY` + - `iam`: injected as `FLEET_SERVER_PRIVATE_KEY_ARN` +- The output `fleet_server_private_key_secret_arn` returns the effective ARN, whether the secret is module-managed or caller-managed. +- Secret value population and lifecycle are entirely caller-managed. + +If the caller-provided secret uses a CMK, the caller must also provide `fleet_config.private_key_secret_kms.kms_key_arn` so the correct ECS execution role or Fleet task role gets decrypt permissions for the selected delivery mode. This module does not inspect external secrets to discover their KMS configuration. + +```hcl +fleet_config = { + private_key_secret_arn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:existing-fleet-private-key" + private_key_delivery_method = "iam" + + private_key_secret_kms = { + cmk_enabled = true + kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/11111111-2222-3333-4444-555555555555" + } +} +``` + ## Migration Notes - Existing deployments are unchanged unless new KMS options are enabled. +- Supplying `fleet_config.private_key_secret_arn` switches the module to use an existing caller-managed secret instead of creating one. - Enabling KMS for application logs sets `kms_key_id` on the module-managed CloudWatch log group. - Enabling KMS for software installers updates S3 default encryption configuration. - Breaking change: software installers CMK policy ownership now lives in `byo-ecs`. The CloudFront addon no longer manages that key policy. diff --git a/byo-vpc/byo-db/byo-ecs/README.md b/byo-vpc/byo-db/byo-ecs/README.md index e6e8331..59ee4bf 100644 --- a/byo-vpc/byo-db/byo-ecs/README.md +++ b/byo-vpc/byo-db/byo-ecs/README.md @@ -96,9 +96,65 @@ fleet_config = { } ``` +## Command Configuration + +Optionally specify a custom command for the Fleet container: + +```hcl +fleet_config = { + # ... other config ... + command = ["/usr/bin/fleet", "agent", "--some-flag"] +} +``` + +## Private Key Delivery Method + +Control how the Fleet server private key is delivered to the container: + +- **ecs** (default): The secret value is injected as `FLEET_SERVER_PRIVATE_KEY` secret. The ECS Execution Role needs Secrets Manager permissions to decrypt the secret. +- **iam**: The secret ARN is injected as `FLEET_SERVER_PRIVATE_KEY_ARN` environment variable. The Fleet task role needs Secrets Manager permissions to decrypt the secret. + +```hcl +fleet_config = { + # ... other config ... + private_key_delivery_method = "iam" # or "ecs" +} +``` + +When `private_key_delivery_method = "iam"`, the KMS key policy for the private key secret grants decrypt permissions to the Fleet task role instead of the ECS execution role. + +## Caller-Provided Private Key Secret + +By default, this module creates and populates the Fleet server private key secret in Secrets Manager. + +To use a caller-managed existing secret instead, set `fleet_config.private_key_secret_arn`. When this is set: + +- This module does not create the Fleet server private key secret, secret version, or generated random value. +- `fleet_config.private_key_secret_name` is ignored. +- The provided ARN is used in both delivery modes: + - `ecs`: injected as `FLEET_SERVER_PRIVATE_KEY` + - `iam`: injected as `FLEET_SERVER_PRIVATE_KEY_ARN` +- The output `fleet_server_private_key_secret_arn` returns the effective ARN, whether the secret is module-managed or caller-managed. +- Secret value population and lifecycle are entirely caller-managed. + +If the caller-provided secret uses a CMK, the caller must also provide `fleet_config.private_key_secret_kms.kms_key_arn` so the correct ECS execution role or Fleet task role gets decrypt permissions for the selected delivery mode. This module does not inspect external secrets to discover their KMS configuration. + +```hcl +fleet_config = { + private_key_secret_arn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:existing-fleet-private-key" + private_key_delivery_method = "iam" + + private_key_secret_kms = { + cmk_enabled = true + kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/11111111-2222-3333-4444-555555555555" + } +} +``` + ## Migration Notes - Existing deployments are unchanged unless new KMS options are enabled. +- Supplying `fleet_config.private_key_secret_arn` switches the module to use an existing caller-managed secret instead of creating one. - Enabling KMS for application logs sets `kms_key_id` on the module-managed CloudWatch log group. - Enabling KMS for software installers updates S3 default encryption configuration. - Breaking change: software installers CMK policy ownership now lives in `byo-ecs`. The CloudFront addon no longer manages that key policy. @@ -125,14 +181,15 @@ DELETE_OLD_STREAMS=false ../../../scripts/cloudwatch_logs_kms_migration.sh [terraform](#requirement\_terraform) | >= 1.5.0 | +| [terraform](#requirement\_terraform) | >= 1.12.0 | +| [aws](#requirement\_aws) | >= 6.37.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | 5.89.0 | -| [random](#provider\_random) | 3.7.1 | +| [aws](#provider\_aws) | 6.38.0 | +| [random](#provider\_random) | 3.8.1 | ## Modules @@ -149,20 +206,16 @@ No modules. | [aws_ecs_service.fleet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service) | resource | | [aws_ecs_task_definition.backend](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition) | resource | | [aws_iam_policy.execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | -| [aws_iam_policy.execution_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_policy.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_policy.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | -| [aws_iam_policy.software_installers_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_role.execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | | [aws_iam_role.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | | [aws_iam_role_policy_attachment.execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.execution_extras](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | -| [aws_iam_role_policy_attachment.execution_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.extras](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.role_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | -| [aws_iam_role_policy_attachment.software_installers_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_kms_alias.application_logs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource | | [aws_kms_alias.private_key_secret](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource | | [aws_kms_alias.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource | @@ -183,10 +236,8 @@ No modules. | [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.fleet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.fleet-execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [aws_iam_policy_document.fleet-execution-kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.private_key_secret_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.software_installers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [aws_iam_policy_document.software_installers_external_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.software_installers_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_kms_key.software_installers_provided](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_key) | data source | | [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source | @@ -197,7 +248,7 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [ecs\_cluster](#input\_ecs\_cluster) | The name of the ECS cluster to use | `string` | n/a | yes | -| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
image = optional(string, "fleetdm/fleet:v4.83.0")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
extra_kms_policies = []
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
})
redis = object({
address = string
use_tls = optional(bool, true)
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
}
})
loadbalancer = object({
arn = string
})
extra_load_balancers = optional(list(any), [])
networking = object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
})
assign_public_ip = optional(bool, false)
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
cloudfront_distribution_arn = optional(string, null)
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
extra_kms_policies = optional(list(any), [])
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
cloudfront_distribution_arn = null
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
extra_kms_policies = []
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"cpu": 256,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.83.0",
"loadbalancer": {
"arn": null
},
"mem": 512,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"cloudfront_distribution_arn": null,
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"extra_kms_policies": [],
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | +| [fleet\_config](#input\_fleet\_config) | The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`. |
object({
task_mem = optional(number, null)
task_cpu = optional(number, null)
ephemeral_storage = optional(object({
size_in_gib = number
}), null)
mem = optional(number, 4096)
cpu = optional(number, 512)
pid_mode = optional(string, null)
command = optional(list(string), null)
private_key_delivery_method = optional(string, "ecs")
image = optional(string, "fleetdm/fleet:v4.83.0")
family = optional(string, "fleet")
sidecars = optional(list(any), [])
depends_on = optional(list(any), [])
mount_points = optional(list(any), [])
volumes = optional(list(any), [])
extra_environment_variables = optional(map(string), {})
extra_iam_policies = optional(list(string), [])
extra_execution_iam_policies = optional(list(string), [])
extra_secrets = optional(map(string), {})
security_group_name = optional(string, "fleet")
iam_role_arn = optional(string, null)
repository_credentials = optional(string, "")
private_key_secret_arn = optional(string, null)
private_key_secret_name = optional(string, "fleet-server-private-key")
private_key_secret_kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-server-private-key")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-server-private-key"
extra_kms_policies = []
})
server_tls_enabled = optional(bool, false)
service = optional(object({
name = optional(string, "fleet")
}), {
name = "fleet"
})
database = object({
password_secret_arn = string
password_secret_kms_key_arn = optional(string, null)
user = string
database = string
address = string
rr_address = optional(string, null)
})
redis = object({
address = string
use_tls = optional(bool, true)
})
awslogs = optional(object({
name = optional(string, null)
region = optional(string, null)
create = optional(bool, true)
prefix = optional(string, "fleet")
retention = optional(number, 5)
kms = optional(object({
cmk_enabled = optional(bool, null)
enabled = optional(bool, null)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-application-logs")
extra_kms_policies = optional(list(any), [])
}), {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
})
}), {
name = null
region = null
create = true
prefix = "fleet"
retention = 5
kms = {
cmk_enabled = null
enabled = null
kms_key_arn = null
kms_alias = "fleet-application-logs"
extra_kms_policies = []
}
})
loadbalancer = object({
arn = string
})
extra_load_balancers = optional(list(any), [])
networking = object({
subnets = optional(list(string), null)
security_groups = optional(list(string), null)
ingress_sources = object({
cidr_blocks = optional(list(string), [])
ipv6_cidr_blocks = optional(list(string), [])
security_groups = optional(list(string), [])
prefix_list_ids = optional(list(string), [])
})
assign_public_ip = optional(bool, false)
})
autoscaling = optional(object({
max_capacity = optional(number, 5)
min_capacity = optional(number, 1)
memory_tracking_target_value = optional(number, 80)
cpu_tracking_target_value = optional(number, 80)
}), {
max_capacity = 5
min_capacity = 1
memory_tracking_target_value = 80
cpu_tracking_target_value = 80
})
iam = optional(object({
role = optional(object({
name = optional(string, "fleet-role")
policy_name = optional(string, "fleet-iam-policy")
}), {
name = "fleet-role"
policy_name = "fleet-iam-policy"
})
execution = optional(object({
name = optional(string, "fleet-execution-role")
policy_name = optional(string, "fleet-execution-role")
}), {
name = "fleet-execution-role"
policy_name = "fleet-iam-policy-execution"
})
}), {
name = "fleetdm-execution-role"
})
software_installers = optional(object({
create_bucket = optional(bool, true)
bucket_name = optional(string, null)
bucket_prefix = optional(string, "fleet-software-installers-")
s3_object_prefix = optional(string, "")
cloudfront_distribution_arn = optional(string, null)
enable_bucket_versioning = optional(bool, false)
expire_noncurrent_versions = optional(bool, true)
noncurrent_version_expiration_days = optional(number, 30)
create_kms_key = optional(bool, false)
kms_key_arn = optional(string, null)
kms_alias = optional(string, "fleet-software-installers")
extra_kms_policies = optional(list(any), [])
tags = optional(map(string), {})
}), {
create_bucket = true
bucket_name = null
bucket_prefix = "fleet-software-installers-"
s3_object_prefix = ""
cloudfront_distribution_arn = null
enable_bucket_versioning = false
expire_noncurrent_versions = true
noncurrent_version_expiration_days = 30
create_kms_key = false
kms_key_arn = null
kms_alias = "fleet-software-installers"
extra_kms_policies = []
tags = {}
})
})
|
{
"autoscaling": {
"cpu_tracking_target_value": 80,
"max_capacity": 5,
"memory_tracking_target_value": 80,
"min_capacity": 1
},
"awslogs": {
"create": true,
"kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-application-logs",
"kms_key_arn": null
},
"name": null,
"prefix": "fleet",
"region": null,
"retention": 5
},
"command": null,
"cpu": 256,
"database": {
"address": null,
"database": null,
"password_secret_arn": null,
"rr_address": null,
"user": null
},
"depends_on": [],
"ephemeral_storage": null,
"extra_environment_variables": {},
"extra_execution_iam_policies": [],
"extra_iam_policies": [],
"extra_load_balancers": [],
"extra_secrets": {},
"family": "fleet",
"iam": {
"execution": {
"name": "fleet-execution-role",
"policy_name": "fleet-iam-policy-execution"
},
"role": {
"name": "fleet-role",
"policy_name": "fleet-iam-policy"
}
},
"iam_role_arn": null,
"image": "fleetdm/fleet:v4.83.0",
"loadbalancer": {
"arn": null
},
"mem": 512,
"mount_points": [],
"networking": {
"assign_public_ip": false,
"ingress_sources": {
"cidr_blocks": [],
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"security_groups": []
},
"security_groups": null,
"subnets": null
},
"pid_mode": null,
"private_key_delivery_method": "ecs",
"private_key_secret_arn": null,
"private_key_secret_kms": {
"cmk_enabled": null,
"enabled": null,
"extra_kms_policies": [],
"kms_alias": "fleet-server-private-key",
"kms_key_arn": null
},
"private_key_secret_name": "fleet-server-private-key",
"redis": {
"address": null,
"use_tls": true
},
"repository_credentials": "",
"security_group_name": "fleet",
"server_tls_enabled": false,
"service": {
"name": "fleet"
},
"sidecars": [],
"software_installers": {
"bucket_name": null,
"bucket_prefix": "fleet-software-installers-",
"cloudfront_distribution_arn": null,
"create_bucket": true,
"create_kms_key": false,
"enable_bucket_versioning": false,
"expire_noncurrent_versions": true,
"extra_kms_policies": [],
"kms_alias": "fleet-software-installers",
"kms_key_arn": null,
"noncurrent_version_expiration_days": 30,
"s3_object_prefix": "",
"tags": {}
},
"task_cpu": null,
"task_mem": null,
"volumes": []
}
| no | | [kms\_base\_policy](#input\_kms\_base\_policy) | Optional base KMS key-policy statements to apply to module-created CMKs before module-required service access statements are merged in. If null, the module defaults to the historical root `kms:*` statement. |
list(object({
sid = string
effect = string
principals = object({
type = string
identifiers = list(string)
})
actions = list(string)
resources = list(string)
conditions = optional(list(object({
test = string
variable = string
values = list(string)
})), [])
}))
| `null` | no | | [migration\_config](#input\_migration\_config) | The configuration object for Fleet's migration task. |
object({
mem = number
cpu = number
})
|
{
"cpu": 1024,
"mem": 2048
}
| no | | [vpc\_id](#input\_vpc\_id) | n/a | `string` | `null` | no | diff --git a/byo-vpc/byo-db/byo-ecs/iam.tf b/byo-vpc/byo-db/byo-ecs/iam.tf index f4c1fc6..f715be9 100644 --- a/byo-vpc/byo-db/byo-ecs/iam.tf +++ b/byo-vpc/byo-db/byo-ecs/iam.tf @@ -36,7 +36,24 @@ locals { resources = [var.fleet_config.database.password_secret_kms_key_arn] effect = "Allow" }] : [] - execution_kms_policy = concat(local.private_key_secret_kms_policy, local.database_password_secret_kms_policy) + private_key_secret_access_policy = [{ + sid = "AllowFleetPrivateKeySecretAccess" + actions = ["secretsmanager:GetSecretValue"] + resources = [local.private_key_secret_arn] + effect = "Allow" + }] + execution_secret_policy = concat([{ + sid = "AllowFleetDatabasePasswordSecretAccess" + actions = ["secretsmanager:GetSecretValue"] + resources = [var.fleet_config.database.password_secret_arn] + effect = "Allow" + }], var.fleet_config.private_key_delivery_method == "ecs" ? local.private_key_secret_access_policy : []) + fleet_secret_policy = var.fleet_config.private_key_delivery_method == "iam" ? local.private_key_secret_access_policy : [] + execution_kms_policy = concat( + var.fleet_config.private_key_delivery_method == "ecs" ? local.private_key_secret_kms_policy : [], + local.database_password_secret_kms_policy + ) + fleet_kms_policy = var.fleet_config.private_key_delivery_method == "iam" ? local.private_key_secret_kms_policy : [] } data "aws_iam_policy_document" "software_installers" { @@ -85,6 +102,26 @@ data "aws_iam_policy_document" "fleet" { resources = ["*"] } + dynamic "statement" { + for_each = local.fleet_secret_policy + content { + sid = try(statement.value.sid, "") + actions = try(statement.value.actions, []) + resources = try(statement.value.resources, []) + effect = try(statement.value.effect, null) + } + } + + dynamic "statement" { + for_each = local.fleet_kms_policy + content { + sid = try(statement.value.sid, "") + actions = try(statement.value.actions, []) + resources = try(statement.value.resources, []) + effect = try(statement.value.effect, null) + } + } + } data "aws_iam_policy_document" "assume_role" { @@ -99,14 +136,14 @@ data "aws_iam_policy_document" "assume_role" { } data "aws_iam_policy_document" "fleet-execution" { - // allow fleet application to obtain the database password from secrets manager - statement { - effect = "Allow" - actions = ["secretsmanager:GetSecretValue"] - resources = [ - var.fleet_config.database.password_secret_arn, - aws_secretsmanager_secret.fleet_server_private_key.arn - ] + dynamic "statement" { + for_each = local.execution_secret_policy + content { + sid = try(statement.value.sid, "") + actions = try(statement.value.actions, []) + resources = try(statement.value.resources, []) + effect = try(statement.value.effect, null) + } } dynamic "statement" { diff --git a/byo-vpc/byo-db/byo-ecs/main.tf b/byo-vpc/byo-db/byo-ecs/main.tf index e42ea06..65f35d8 100644 --- a/byo-vpc/byo-db/byo-ecs/main.tf +++ b/byo-vpc/byo-db/byo-ecs/main.tf @@ -19,10 +19,12 @@ locals { credentialsParameter = var.fleet_config.repository_credentials } } : null - private_key_secret_cmk_enabled = coalesce(var.fleet_config.private_key_secret_kms.cmk_enabled, var.fleet_config.private_key_secret_kms.enabled, false) - private_key_secret_create_kms_key = local.private_key_secret_cmk_enabled == true && var.fleet_config.private_key_secret_kms.kms_key_arn == null + private_key_secret_is_module_managed = var.fleet_config.private_key_secret_arn == null + private_key_secret_arn = local.private_key_secret_is_module_managed ? aws_secretsmanager_secret.fleet_server_private_key[0].arn : var.fleet_config.private_key_secret_arn + private_key_secret_cmk_enabled = coalesce(var.fleet_config.private_key_secret_kms.cmk_enabled, var.fleet_config.private_key_secret_kms.enabled, false) + private_key_secret_create_kms_key = local.private_key_secret_is_module_managed == true && local.private_key_secret_cmk_enabled == true && var.fleet_config.private_key_secret_kms.kms_key_arn == null private_key_secret_kms_key_arn = local.private_key_secret_cmk_enabled == true ? ( - var.fleet_config.private_key_secret_kms.kms_key_arn != null ? var.fleet_config.private_key_secret_kms.kms_key_arn : aws_kms_key.private_key_secret[0].arn + var.fleet_config.private_key_secret_kms.kms_key_arn != null ? var.fleet_config.private_key_secret_kms.kms_key_arn : (local.private_key_secret_create_kms_key == true ? aws_kms_key.private_key_secret[0].arn : null) ) : null application_logs_cmk_enabled = coalesce(var.fleet_config.awslogs.kms.cmk_enabled, var.fleet_config.awslogs.kms.enabled, false) @@ -37,7 +39,8 @@ locals { software_installers_kms_key_id = var.fleet_config.software_installers.create_kms_key == true || var.fleet_config.software_installers.kms_key_arn != null ? ( var.fleet_config.software_installers.kms_key_arn != null ? data.aws_kms_key.software_installers_provided[0].key_id : aws_kms_key.software_installers[0].id ) : null - task_role_kms_principal_arn = var.fleet_config.iam_role_arn != null ? var.fleet_config.iam_role_arn : aws_iam_role.main[0].arn + task_role_kms_principal_arn = var.fleet_config.iam_role_arn != null ? var.fleet_config.iam_role_arn : aws_iam_role.main[0].arn + private_key_secret_kms_principal_arn = var.fleet_config.private_key_delivery_method == "iam" ? local.task_role_kms_principal_arn : "arn:${data.aws_partition.current.partition}:iam::${data.aws_caller_identity.current.account_id}:role/${var.fleet_config.iam.execution.name}" kms_base_policy_statements = var.kms_base_policy != null ? var.kms_base_policy : [ { sid = "EnableRootPermissions" @@ -92,7 +95,7 @@ locals { effect = "Allow" principals = { type = "AWS" - identifiers = ["arn:${data.aws_partition.current.partition}:iam::${data.aws_caller_identity.current.account_id}:role/${var.fleet_config.iam.execution.name}"] + identifiers = [local.private_key_secret_kms_principal_arn] } actions = [ "kms:Decrypt", @@ -226,100 +229,107 @@ resource "aws_ecs_task_definition" "backend" { } container_definitions = jsonencode( concat([ - { - name = "fleet" - image = var.fleet_config.image - cpu = var.fleet_config.cpu - memory = var.fleet_config.mem - mountPoints = var.fleet_config.mount_points - dependsOn = var.fleet_config.depends_on - volumesFrom = [] - essential = true - portMappings = [ - { - # This port is the same that the contained application also uses - containerPort = 8080 - protocol = "tcp" - } - ] - repositoryCredentials = local.repository_credentials - networkMode = "awsvpc" - logConfiguration = { - logDriver = "awslogs" - options = { - awslogs-group = var.fleet_config.awslogs.create == true ? aws_cloudwatch_log_group.main[0].name : var.fleet_config.awslogs.name - awslogs-region = var.fleet_config.awslogs.create == true ? data.aws_region.current.id : var.fleet_config.awslogs.region - awslogs-stream-prefix = var.fleet_config.awslogs.prefix + merge( + { + name = "fleet" + image = var.fleet_config.image + cpu = var.fleet_config.cpu + memory = var.fleet_config.mem + mountPoints = var.fleet_config.mount_points + dependsOn = var.fleet_config.depends_on + volumesFrom = [] + essential = true + portMappings = [ + { + # This port is the same that the contained application also uses + containerPort = 8080 + protocol = "tcp" + } + ] + repositoryCredentials = local.repository_credentials + networkMode = "awsvpc" + logConfiguration = { + logDriver = "awslogs" + options = { + awslogs-group = var.fleet_config.awslogs.create == true ? aws_cloudwatch_log_group.main[0].name : var.fleet_config.awslogs.name + awslogs-region = var.fleet_config.awslogs.create == true ? data.aws_region.current.id : var.fleet_config.awslogs.region + awslogs-stream-prefix = var.fleet_config.awslogs.prefix + } } + ulimits = [ + { + name = "nofile" + softLimit = 999999 + hardLimit = 999999 + } + ] + secrets = concat([ + { + name = "FLEET_MYSQL_PASSWORD" + valueFrom = var.fleet_config.database.password_secret_arn + }, + { + name = "FLEET_MYSQL_READ_REPLICA_PASSWORD" + valueFrom = var.fleet_config.database.password_secret_arn + } + ], var.fleet_config.private_key_delivery_method == "ecs" ? [{ + name = "FLEET_SERVER_PRIVATE_KEY" + valueFrom = local.private_key_secret_arn + }] : [], local.secrets) + environment = concat([ + { + name = "FLEET_MYSQL_USERNAME" + value = var.fleet_config.database.user + }, + { + name = "FLEET_MYSQL_DATABASE" + value = var.fleet_config.database.database + }, + { + name = "FLEET_MYSQL_ADDRESS" + value = var.fleet_config.database.address + }, + { + name = "FLEET_MYSQL_READ_REPLICA_USERNAME" + value = var.fleet_config.database.user + }, + { + name = "FLEET_MYSQL_READ_REPLICA_DATABASE" + value = var.fleet_config.database.database + }, + { + name = "FLEET_MYSQL_READ_REPLICA_ADDRESS" + value = var.fleet_config.database.rr_address == null ? var.fleet_config.database.address : var.fleet_config.database.rr_address + }, + { + name = "FLEET_REDIS_ADDRESS" + value = var.fleet_config.redis.address + }, + { + name = "FLEET_REDIS_USE_TLS" + value = tostring(var.fleet_config.redis.use_tls) + }, + { + name = "FLEET_SERVER_TLS" + value = tostring(var.fleet_config.server_tls_enabled) + }, + { + name = "FLEET_S3_SOFTWARE_INSTALLERS_BUCKET" + value = var.fleet_config.software_installers.create_bucket == true ? aws_s3_bucket.software_installers[0].bucket : var.fleet_config.software_installers.bucket_name + }, + { + name = "FLEET_S3_SOFTWARE_INSTALLERS_PREFIX" + value = var.fleet_config.software_installers.s3_object_prefix + } + ], var.fleet_config.private_key_delivery_method == "iam" ? [{ + name = "FLEET_SERVER_PRIVATE_KEY_ARN" + value = local.private_key_secret_arn + }] : [], local.environment) }, - ulimits = [ - { - name = "nofile" - softLimit = 999999 - hardLimit = 999999 - } - ], - secrets = concat([ - { - name = "FLEET_MYSQL_PASSWORD" - valueFrom = var.fleet_config.database.password_secret_arn - }, - { - name = "FLEET_MYSQL_READ_REPLICA_PASSWORD" - valueFrom = var.fleet_config.database.password_secret_arn - }, - { - name = "FLEET_SERVER_PRIVATE_KEY" - valueFrom = aws_secretsmanager_secret.fleet_server_private_key.arn - } - ], local.secrets) - environment = concat([ - { - name = "FLEET_MYSQL_USERNAME" - value = var.fleet_config.database.user - }, - { - name = "FLEET_MYSQL_DATABASE" - value = var.fleet_config.database.database - }, - { - name = "FLEET_MYSQL_ADDRESS" - value = var.fleet_config.database.address - }, - { - name = "FLEET_MYSQL_READ_REPLICA_USERNAME" - value = var.fleet_config.database.user - }, - { - name = "FLEET_MYSQL_READ_REPLICA_DATABASE" - value = var.fleet_config.database.database - }, - { - name = "FLEET_MYSQL_READ_REPLICA_ADDRESS" - value = var.fleet_config.database.rr_address == null ? var.fleet_config.database.address : var.fleet_config.database.rr_address - }, - { - name = "FLEET_REDIS_ADDRESS" - value = var.fleet_config.redis.address - }, - { - name = "FLEET_REDIS_USE_TLS" - value = tostring(var.fleet_config.redis.use_tls) - }, - { - name = "FLEET_SERVER_TLS" - value = tostring(var.fleet_config.server_tls_enabled) - }, - { - name = "FLEET_S3_SOFTWARE_INSTALLERS_BUCKET" - value = var.fleet_config.software_installers.create_bucket == true ? aws_s3_bucket.software_installers[0].bucket : var.fleet_config.software_installers.bucket_name - }, - { - name = "FLEET_S3_SOFTWARE_INSTALLERS_PREFIX" - value = var.fleet_config.software_installers.s3_object_prefix - }, - ], local.environment) - } + var.fleet_config.command != null ? { + command = var.fleet_config.command + } : {} + ) ], var.fleet_config.sidecars)) dynamic "volume" { for_each = var.fleet_config.volumes @@ -506,11 +516,13 @@ resource "aws_security_group" "main" { } resource "random_password" "fleet_server_private_key" { + count = local.private_key_secret_is_module_managed ? 1 : 0 length = 32 special = true } resource "aws_secretsmanager_secret" "fleet_server_private_key" { + count = local.private_key_secret_is_module_managed ? 1 : 0 name = var.fleet_config.private_key_secret_name kms_key_id = local.private_key_secret_kms_key_arn @@ -521,8 +533,9 @@ resource "aws_secretsmanager_secret" "fleet_server_private_key" { } resource "aws_secretsmanager_secret_version" "fleet_server_private_key" { - secret_id = aws_secretsmanager_secret.fleet_server_private_key.id - secret_string = random_password.fleet_server_private_key.result + count = local.private_key_secret_is_module_managed ? 1 : 0 + secret_id = aws_secretsmanager_secret.fleet_server_private_key[0].id + secret_string = random_password.fleet_server_private_key[0].result } // Bucket logging is not supported in our Fleet Terraforms at the moment. It can be enabled by the diff --git a/byo-vpc/byo-db/byo-ecs/outputs.tf b/byo-vpc/byo-db/byo-ecs/outputs.tf index 877600b..1109ca9 100644 --- a/byo-vpc/byo-db/byo-ecs/outputs.tf +++ b/byo-vpc/byo-db/byo-ecs/outputs.tf @@ -40,7 +40,7 @@ output "fleet_config" { } output "fleet_server_private_key_secret_arn" { - value = aws_secretsmanager_secret.fleet_server_private_key.arn + value = local.private_key_secret_arn } output "fleet_server_private_key_secret_kms_key_arn" { diff --git a/byo-vpc/byo-db/byo-ecs/variables.tf b/byo-vpc/byo-db/byo-ecs/variables.tf index a326512..d577ca7 100644 --- a/byo-vpc/byo-db/byo-ecs/variables.tf +++ b/byo-vpc/byo-db/byo-ecs/variables.tf @@ -39,6 +39,8 @@ variable "fleet_config" { mem = optional(number, 4096) cpu = optional(number, 512) pid_mode = optional(string, null) + command = optional(list(string), null) + private_key_delivery_method = optional(string, "ecs") image = optional(string, "fleetdm/fleet:v4.83.0") family = optional(string, "fleet") sidecars = optional(list(any), []) @@ -52,6 +54,7 @@ variable "fleet_config" { security_group_name = optional(string, "fleet") iam_role_arn = optional(string, null) repository_credentials = optional(string, "") + private_key_secret_arn = optional(string, null) private_key_secret_name = optional(string, "fleet-server-private-key") private_key_secret_kms = optional(object({ cmk_enabled = optional(bool, null) @@ -198,6 +201,8 @@ variable "fleet_config" { mem = 512 cpu = 256 pid_mode = null + command = null + private_key_delivery_method = "ecs" image = "fleetdm/fleet:v4.83.0" family = "fleet" sidecars = [] @@ -211,6 +216,7 @@ variable "fleet_config" { security_group_name = "fleet" iam_role_arn = null repository_credentials = "" + private_key_secret_arn = null private_key_secret_name = "fleet-server-private-key" private_key_secret_kms = { cmk_enabled = null @@ -297,6 +303,11 @@ variable "fleet_config" { } description = "The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`." nullable = false + validation { + condition = contains(["ecs", "iam"], var.fleet_config.private_key_delivery_method) + error_message = "fleet_config.private_key_delivery_method must be either \"ecs\" or \"iam\"." + } + validation { condition = var.fleet_config.ephemeral_storage == null ? true : (var.fleet_config.ephemeral_storage.size_in_gib >= 21 && var.fleet_config.ephemeral_storage.size_in_gib <= 200) error_message = "fleet_config.ephemeral_storage.size_in_gib must be between 21 and 200 GiB when set." @@ -314,6 +325,7 @@ variable "fleet_config" { condition = ( length(var.fleet_config.private_key_secret_kms.extra_kms_policies) == 0 || ( + var.fleet_config.private_key_secret_arn == null && coalesce(var.fleet_config.private_key_secret_kms.cmk_enabled, var.fleet_config.private_key_secret_kms.enabled, false) && var.fleet_config.private_key_secret_kms.kms_key_arn == null ) diff --git a/byo-vpc/byo-db/variables.tf b/byo-vpc/byo-db/variables.tf index 305571e..bff04d4 100644 --- a/byo-vpc/byo-db/variables.tf +++ b/byo-vpc/byo-db/variables.tf @@ -160,6 +160,8 @@ variable "fleet_config" { mem = optional(number, 4096) cpu = optional(number, 512) pid_mode = optional(string, null) + command = optional(list(string), null) + private_key_delivery_method = optional(string, "ecs") image = optional(string, "fleetdm/fleet:v4.83.0") family = optional(string, "fleet") sidecars = optional(list(any), []) @@ -173,6 +175,7 @@ variable "fleet_config" { security_group_name = optional(string, "fleet") iam_role_arn = optional(string, null) repository_credentials = optional(string, "") + private_key_secret_arn = optional(string, null) private_key_secret_name = optional(string, "fleet-server-private-key") private_key_secret_kms = optional(object({ cmk_enabled = optional(bool, null) @@ -359,6 +362,8 @@ variable "fleet_config" { mem = 4096 cpu = 512 pid_mode = null + command = null + private_key_delivery_method = "ecs" image = "fleetdm/fleet:v4.83.0" family = "fleet" sidecars = [] @@ -369,10 +374,10 @@ variable "fleet_config" { extra_iam_policies = [] extra_execution_iam_policies = [] extra_secrets = {} - security_groups = null security_group_name = "fleet" iam_role_arn = null repository_credentials = "" + private_key_secret_arn = null private_key_secret_name = "fleet-server-private-key" private_key_secret_kms = { cmk_enabled = null @@ -485,6 +490,10 @@ variable "fleet_config" { ) error_message = "fleet_config.fargate_ephemeral_storage_kms.extra_kms_policies can be set only when byo-db is creating the Fargate ephemeral storage CMK." } + validation { + condition = contains(["ecs", "iam"], var.fleet_config.private_key_delivery_method) + error_message = "fleet_config.private_key_delivery_method must be either \"ecs\" or \"iam\"." + } } variable "migration_config" { diff --git a/byo-vpc/variables.tf b/byo-vpc/variables.tf index 2af1d36..df51a27 100644 --- a/byo-vpc/variables.tf +++ b/byo-vpc/variables.tf @@ -429,6 +429,8 @@ variable "fleet_config" { mem = optional(number, 4096) cpu = optional(number, 512) pid_mode = optional(string, null) + command = optional(list(string), null) + private_key_delivery_method = optional(string, "ecs") image = optional(string, "fleetdm/fleet:v4.83.0") family = optional(string, "fleet") sidecars = optional(list(any), []) @@ -442,6 +444,7 @@ variable "fleet_config" { security_group_name = optional(string, "fleet") iam_role_arn = optional(string, null) repository_credentials = optional(string, "") + private_key_secret_arn = optional(string, null) private_key_secret_name = optional(string, "fleet-server-private-key") private_key_secret_kms = optional(object({ cmk_enabled = optional(bool, null) @@ -628,6 +631,8 @@ variable "fleet_config" { mem = 4096 cpu = 512 pid_mode = null + command = null + private_key_delivery_method = "ecs" image = "fleetdm/fleet:v4.83.0" family = "fleet" sidecars = [] @@ -642,6 +647,7 @@ variable "fleet_config" { security_group_name = "fleet" iam_role_arn = null repository_credentials = "" + private_key_secret_arn = null private_key_secret_name = "fleet-server-private-key" private_key_secret_kms = { cmk_enabled = null @@ -733,6 +739,10 @@ variable "fleet_config" { tags = {} } } + validation { + condition = contains(["ecs", "iam"], var.fleet_config.private_key_delivery_method) + error_message = "fleet_config.private_key_delivery_method must be either \"ecs\" or \"iam\"." + } description = "The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`." nullable = false } diff --git a/variables.tf b/variables.tf index f424dc7..16e1f56 100644 --- a/variables.tf +++ b/variables.tf @@ -517,6 +517,8 @@ variable "fleet_config" { mem = optional(number, 4096) cpu = optional(number, 512) pid_mode = optional(string, null) + command = optional(list(string), null) + private_key_delivery_method = optional(string, "ecs") image = optional(string, "fleetdm/fleet:v4.83.0") family = optional(string, "fleet") sidecars = optional(list(any), []) @@ -530,6 +532,7 @@ variable "fleet_config" { security_group_name = optional(string, "fleet") iam_role_arn = optional(string, null) repository_credentials = optional(string, "") + private_key_secret_arn = optional(string, null) private_key_secret_name = optional(string, "fleet-server-private-key") private_key_secret_kms = optional(object({ cmk_enabled = optional(bool, null) @@ -716,6 +719,8 @@ variable "fleet_config" { mem = 4096 cpu = 512 pid_mode = null + command = null + private_key_delivery_method = "ecs" image = "fleetdm/fleet:v4.83.0" family = "fleet" sidecars = [] @@ -730,6 +735,7 @@ variable "fleet_config" { security_group_name = "fleet" iam_role_arn = null repository_credentials = "" + private_key_secret_arn = null private_key_secret_name = "fleet-server-private-key" private_key_secret_kms = { cmk_enabled = null @@ -821,6 +827,10 @@ variable "fleet_config" { tags = {} } } + validation { + condition = contains(["ecs", "iam"], var.fleet_config.private_key_delivery_method) + error_message = "fleet_config.private_key_delivery_method must be either \"ecs\" or \"iam\"." + } description = "The configuration object for Fleet itself. Fields that default to null will have their respective resources created if not specified. For published KMS blocks, legacy `enabled` is deprecated and still accepted; prefer `cmk_enabled`." nullable = false }