diff --git a/README.md b/README.md index a2310c5..f81a885 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # Terraform AWS Serverless App Module Terraform module to create AWS Serverless application. - ## How to use: -```terraform +```hcl module "pecan" { name = "pecan" source = "hazelops/sls-app/aws" @@ -11,7 +10,7 @@ module "pecan" { vpc_id = module.vpc.vpc_id public_subnets = module.vpc.public_subnets private_subnets = module.vpc.private_subnets - security_groups = [aws_security_group.default_permissive.id] + security_groups = ["sg-xxxxxxxxxxxxxxxxx"] parameters = { "API_KEY": "demo" @@ -26,18 +25,19 @@ module "pecan" { } ``` - + ## Requirements | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | +| [aws](#requirement\_aws) | ~> 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | n/a | +| [aws](#provider\_aws) | ~> 5.0 | ## Modules @@ -59,15 +59,18 @@ module "pecan" { |------|-------------|------|---------|:--------:| | [app\_secrets](#input\_app\_secrets) | List of SSM ParameterStore secret parameters - by default, /$var.env/$var.name/* | `list(any)` | `[]` | no | | [env](#input\_env) | n/a | `any` | n/a | yes | -| [global\_parameters](#input\_global\_parameters) | n/a | `map(string)` | `{}` | no | +| [global\_parameters](#input\_global\_parameters) | Map of SSM ParameterStore global parameters to store - by default, /$var.env/global/* | `map(string)` | `{}` | no | | [global\_secrets](#input\_global\_secrets) | List of SSM ParameterStore global secrets - by default, /$var.env/global/* | `list(any)` | `[]` | no | +| [join\_lists](#input\_join\_lists) | Whether to join lists like subnets and security groups into a one SSM parameter string with comma separator | `bool` | `false` | no | | [name](#input\_name) | n/a | `any` | n/a | yes | -| [parameters](#input\_parameters) | n/a | `map(string)` | n/a | yes | +| [parameters](#input\_parameters) | Map of SSM ParameterStore parameters to store - by default, /$var.env/$var.name/* | `map(string)` | n/a | yes | | [private\_subnets](#input\_private\_subnets) | VPC Private subnets to place SLS resources | `list(any)` | `[]` | no | | [public\_subnets](#input\_public\_subnets) | VPC Public subnets to place SLS resources | `list(any)` | `[]` | no | | [security\_groups](#input\_security\_groups) | Security groups to assign to SLS | `list(any)` | `[]` | no | -| [vpc\_id](#input\_vpc\_id) | AWS VPC ID | `string` | `""` | no | +| [serialize\_lists](#input\_serialize\_lists) | Whether to serialize lists like subnets and security groups into a one SSM parameter | `bool` | `true` | no | +| [vpc\_id](#input\_vpc\_id) | AWS VPC ID | `string` | `"-"` | no | ## Outputs -No outputs. \ No newline at end of file +No outputs. + diff --git a/main.tf b/main.tf index e7412b9..17f6dbb 100644 --- a/main.tf +++ b/main.tf @@ -3,9 +3,8 @@ resource "aws_ssm_parameter" "sls_parameter" { name = "/${var.env}/${var.name}/${each.key}" - value = each.value - type = "String" - overwrite = true + value = each.value + type = "String" } resource "aws_ssm_parameter" "sls_global_parameter" { @@ -13,9 +12,8 @@ resource "aws_ssm_parameter" "sls_global_parameter" { name = "/${var.env}/global/${each.key}" - value = each.value - type = "String" - overwrite = true + value = each.value + type = "String" } module "secrets" { diff --git a/variables.tf b/variables.tf index d9186d5..72223ca 100644 --- a/variables.tf +++ b/variables.tf @@ -2,12 +2,14 @@ variable "name" {} variable "env" {} variable "parameters" { - type = map(string) + type = map(string) + description = "Map of SSM ParameterStore parameters to store - by default, /$var.env/$var.name/*" } variable "global_parameters" { - type = map(string) - default = {} + type = map(string) + description = "Map of SSM ParameterStore global parameters to store - by default, /$var.env/global/*" + default = {} } variable "app_secrets" { diff --git a/versions.tf b/versions.tf index 77ef34b..802f8c4 100644 --- a/versions.tf +++ b/versions.tf @@ -1,7 +1,8 @@ terraform { required_providers { aws = { - source = "hashicorp/aws" + source = "hashicorp/aws" + version = "~> 5.0" } } required_version = ">= 1.0"