|
| 1 | +variable "abort_incomplete_multipart_upload_days" { |
| 2 | + type = number |
| 3 | + description = "Number of days to abort incomplete multipart uploads." |
| 4 | + default = 7 |
| 5 | + |
| 6 | + validation { |
| 7 | + condition = var.abort_incomplete_multipart_upload_days > 0 |
| 8 | + error_message = "Abort incomplete multipart upload days must be greater than 0." |
| 9 | + } |
| 10 | +} |
| 11 | + |
| 12 | +variable "allowed_principals" { |
| 13 | + type = list(string) |
| 14 | + description = <<-EOT |
| 15 | + List of AWS principal ARNs to allow to use the KMS key. This is used to |
| 16 | + grant access to other resources that need to use the key, such as ECS task |
| 17 | + roles. |
| 18 | + EOT |
| 19 | +} |
| 20 | + |
| 21 | +variable "encryption_key_arn" { |
| 22 | + type = string |
| 23 | + description = "ARN of the KMS key to use for S3 bucket encryption. If not provided, a new KMS key will be created." |
| 24 | + default = null |
| 25 | +} |
| 26 | + |
| 27 | +variable "environment" { |
| 28 | + type = string |
| 29 | + description = "The environment for the deployment." |
| 30 | + default = "development" |
| 31 | +} |
| 32 | + |
| 33 | +variable "force_delete" { |
| 34 | + type = bool |
| 35 | + description = "Whether to force delete the bucket and its contents." |
| 36 | + default = false |
| 37 | +} |
| 38 | + |
| 39 | +variable "key_recovery_period" { |
| 40 | + type = number |
| 41 | + description = "Number of days to recover the created KMS key after deletion. Must be between 7 and 30." |
| 42 | + default = 30 |
| 43 | + |
| 44 | + validation { |
| 45 | + condition = var.key_recovery_period > 6 && var.key_recovery_period < 31 |
| 46 | + error_message = "Key recovery period must be between 7 and 30." |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +variable "logging_bucket" { |
| 51 | + type = string |
| 52 | + description = "S3 bucket to send access logs to." |
| 53 | +} |
| 54 | + |
| 55 | +variable "name" { |
| 56 | + type = string |
| 57 | + description = "Name of the bucket. The project and environment will be prepended to this automatically." |
| 58 | +} |
| 59 | + |
| 60 | +variable "noncurrent_version_expiration_days" { |
| 61 | + type = number |
| 62 | + description = "Number of days to expire noncurrent versions of objects." |
| 63 | + default = 30 |
| 64 | + |
| 65 | + validation { |
| 66 | + condition = var.noncurrent_version_expiration_days > 0 |
| 67 | + error_message = "Noncurrent version expiration days must be greater than 0." |
| 68 | + } |
| 69 | + |
| 70 | + validation { |
| 71 | + condition = var.noncurrent_version_expiration_days <= var.abort_incomplete_multipart_upload_days |
| 72 | + error_message = "Noncurrent version expiration days must be less than or equal to the abort incomplete multipart upload days." |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +variable "storage_class_transitions" { |
| 77 | + type = list(object({ |
| 78 | + days = number |
| 79 | + storage_class = string |
| 80 | + })) |
| 81 | + |
| 82 | + description = "List of storage class transitions to apply to the bucket." |
| 83 | + default = [{ |
| 84 | + days = 30 |
| 85 | + storage_class = "STANDARD_IA" |
| 86 | + }] |
| 87 | +} |
| 88 | + |
| 89 | +variable "project" { |
| 90 | + type = string |
| 91 | + description = "Project that these resources are supporting." |
| 92 | +} |
| 93 | + |
| 94 | +variable "tags" { |
| 95 | + type = map(string) |
| 96 | + description = "Optional tags to be applied to all resources." |
| 97 | + default = {} |
| 98 | +} |
0 commit comments