Skip to content

Commit 5f1ee70

Browse files
committed
simplify architectures variable
1 parent a451a38 commit 5f1ee70

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

README.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -89,33 +89,33 @@ module "lambda_api" {
8989
* AWS provider version 3.0 or greater
9090

9191
## Inputs
92-
| Name | Type | Description | Default |
93-
| --- | --- | --- | --- |
94-
| app_name | string | Application name to name your Lambda API and other resources (Must be <= 28 alphanumeric characters) | |
95-
| image_uri | string | ECR Image URI containing the function's deployment package (conflicts with `zip_file`)| null |
96-
| zip_filename | string | File that contains your compiled or zipped source code. |
97-
| zip_handler | string | Lambda event handler |
98-
| zip_runtime | string | Lambda runtime |
99-
| lambda_vpc_config | [object](#lambda_vpc_config) | Lambda VPC object. Used if lambda requires to run inside a VPC | null |
100-
| environment_variables | map(string) | A map that defines environment variables for the Lambda function. | |
101-
| domain_url | string | Custom domain URL for the API, defaults to <app_name>.<hosted_zone_domain> | null | |
102-
| hosted_zone | [object](#hosted_zone) | Hosted Zone object to redirect to ALB. (Can pass in the aws_hosted_zone object). A and AAAA records created in this hosted zone. | |
103-
| https_certificate_arn | string | ARN of the HTTPS certificate of the hosted zone/domain. | |
104-
| codedeploy_service_role_arn | string | ARN of the IAM Role for the CodeDeploy to use to initiate new deployments. (usually the PowerBuilder Role) |
105-
| codedeploy_lifecycle_hooks | [object](#codedeploy_lifecycle_hooks) | Define Lambda Functions for CodeDeploy lifecycle event hooks. Or set this variable to null to not have any lifecycle hooks invoked. Defaults to null | null
106-
| codedeploy_appspec_filename | string | Filename (including path) to use when outputing appspec json. | `appspec.json` in the current working directory (i.e. where you ran `terraform apply`) |
107-
| codedeploy_test_listener_port | number | The port for a codedeploy test listener. If provided CodeDeploy will use this port for test traffic on the new replacement set during the blue-green deployment process before shifting production traffic to the replacement set. Defaults to null | null
108-
| vpc_id | string | VPC ID to deploy ALB and Lambda (If specified). | |
109-
| public_subnet_ids | list(string) | List of subnet IDs for the ALB. | |
110-
| tags | map(string) | A map of AWS Tags to attach to each resource created | {} |
111-
| role_permissions_boundary_arn | string | IAM Role Permissions Boundary ARN | |
112-
| log_retention_in_days | number | CloudWatch log group retention in days. Defaults to 7. | 7 |
113-
| lambda_policies | list(string) | List of IAM Policy ARNs to attach to the lambda role. | [] |
114-
| lambda_layers | list(string) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your function. | [] |
115-
| timeout | number | How long the lambda will run (in seconds) before timing out | 3 (same as terraform default) |
116-
| memory_size | number | Size of the memory of the lambda. CPU will scale along with it | 128 (same as terraform default) |
117-
| xray_enabled | bool | Whether or not the X-Ray daemon should be created with the Lambda API. | false |
118-
| architectures | list(string) | (Optional) Instruction set architecture for your Lambda function. Valid values are [\"x86_64\"] and [\"arm64\"]. Default is [\"x86_64\"]. Removing this attribute, function's architecture stay the same. | ["x86_64"] |
92+
| Name | Type | Description | Default |
93+
|-------------------------------|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
94+
| app_name | string | Application name to name your Lambda API and other resources (Must be <= 28 alphanumeric characters) | |
95+
| image_uri | string | ECR Image URI containing the function's deployment package (conflicts with `zip_file`) | null |
96+
| zip_filename | string | File that contains your compiled or zipped source code. | |
97+
| zip_handler | string | Lambda event handler | |
98+
| zip_runtime | string | Lambda runtime | |
99+
| lambda_vpc_config | [object](#lambda_vpc_config) | Lambda VPC object. Used if lambda requires to run inside a VPC | null |
100+
| environment_variables | map(string) | A map that defines environment variables for the Lambda function. | |
101+
| domain_url | string | Custom domain URL for the API, defaults to <app_name>.<hosted_zone_domain> | null |
102+
| hosted_zone | [object](#hosted_zone) | Hosted Zone object to redirect to ALB. (Can pass in the aws_hosted_zone object). A and AAAA records created in this hosted zone. | |
103+
| https_certificate_arn | string | ARN of the HTTPS certificate of the hosted zone/domain. | |
104+
| codedeploy_service_role_arn | string | ARN of the IAM Role for the CodeDeploy to use to initiate new deployments. (usually the PowerBuilder Role) | |
105+
| codedeploy_lifecycle_hooks | [object](#codedeploy_lifecycle_hooks) | Define Lambda Functions for CodeDeploy lifecycle event hooks. Or set this variable to null to not have any lifecycle hooks invoked. Defaults to null | null |
106+
| codedeploy_appspec_filename | string | Filename (including path) to use when outputing appspec json. | `appspec.json` in the current working directory (i.e. where you ran `terraform apply`) |
107+
| codedeploy_test_listener_port | number | The port for a codedeploy test listener. If provided CodeDeploy will use this port for test traffic on the new replacement set during the blue-green deployment process before shifting production traffic to the replacement set. Defaults to null | null |
108+
| vpc_id | string | VPC ID to deploy ALB and Lambda (If specified). | |
109+
| public_subnet_ids | list(string) | List of subnet IDs for the ALB. | |
110+
| tags | map(string) | A map of AWS Tags to attach to each resource created | {} |
111+
| role_permissions_boundary_arn | string | IAM Role Permissions Boundary ARN | |
112+
| log_retention_in_days | number | CloudWatch log group retention in days. Defaults to 7. | 7 |
113+
| lambda_policies | list(string) | List of IAM Policy ARNs to attach to the lambda role. | [] |
114+
| lambda_layers | list(string) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your function. | [] |
115+
| timeout | number | How long the lambda will run (in seconds) before timing out | 3 (same as terraform default) |
116+
| memory_size | number | Size of the memory of the lambda. CPU will scale along with it | 128 (same as terraform default) |
117+
| xray_enabled | bool | Whether or not the X-Ray daemon should be created with the Lambda API. | false |
118+
| architectures | string | (Optional) Instruction set architecture for your Lambda function. Valid values are [\"x86_64\"] and [\"arm64\"]. Default is [\"x86_64\"]. Removing this attribute, function's architecture stay the same. | "x86_64" |
119119

120120
#### lambda_vpc_config
121121

@@ -148,17 +148,17 @@ For instance with the [above example](#usage) the logs could be found in the Clo
148148

149149
## Outputs
150150

151-
| Name | Type | Description |
152-
| --- | --- | --- |
153-
| lambda | [object](https://www.terraform.io/docs/providers/aws/r/lambda_function.html#argument-reference) | The Lambda that handles API requests |
154-
| lambda_security_group | [object](https://www.terraform.io/docs/providers/aws/r/security_group.html#argument-reference) | Controls what the Lambda can access |
155-
| lambda_live_alias | [object](https://www.terraform.io/docs/providers/aws/r/lambda_alias.html#argument-reference) | Controls which version of the Lambda receives "live" traffic |
156-
| codedeploy_deployment_group | [object](https://www.terraform.io/docs/providers/aws/r/codedeploy_deployment_group.html#argument-reference) | The CodeDeploy deployment group object. |
157-
| codedeploy_appspec_json_file | string | Filename of the generated appspec.json file |
158-
| alb | [object](https://www.terraform.io/docs/providers/aws/r/lb.html#argument-reference) | The Application Load Balancer (ALB) object |
159-
| alb_security_group | [object](https://www.terraform.io/docs/providers/aws/r/security_group.html#argument-reference) | The ALB's security group object |
160-
| dns_record | [object](https://www.terraform.io/docs/providers/aws/r/route53_record.html#argument-reference) | The DNS A-record mapped to the ALB |
161-
| cloudwatch_log_group | [object](https://www.terraform.io/docs/providers/aws/r/cloudwatch_log_group.html#argument-reference) | The log group for the Lambda's logs |
151+
| Name | Type | Description |
152+
|------------------------------|-------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
153+
| lambda | [object](https://www.terraform.io/docs/providers/aws/r/lambda_function.html#argument-reference) | The Lambda that handles API requests |
154+
| lambda_security_group | [object](https://www.terraform.io/docs/providers/aws/r/security_group.html#argument-reference) | Controls what the Lambda can access |
155+
| lambda_live_alias | [object](https://www.terraform.io/docs/providers/aws/r/lambda_alias.html#argument-reference) | Controls which version of the Lambda receives "live" traffic |
156+
| codedeploy_deployment_group | [object](https://www.terraform.io/docs/providers/aws/r/codedeploy_deployment_group.html#argument-reference) | The CodeDeploy deployment group object. |
157+
| codedeploy_appspec_json_file | string | Filename of the generated appspec.json file |
158+
| alb | [object](https://www.terraform.io/docs/providers/aws/r/lb.html#argument-reference) | The Application Load Balancer (ALB) object |
159+
| alb_security_group | [object](https://www.terraform.io/docs/providers/aws/r/security_group.html#argument-reference) | The ALB's security group object |
160+
| dns_record | [object](https://www.terraform.io/docs/providers/aws/r/route53_record.html#argument-reference) | The DNS A-record mapped to the ALB |
161+
| cloudwatch_log_group | [object](https://www.terraform.io/docs/providers/aws/r/cloudwatch_log_group.html#argument-reference) | The log group for the Lambda's logs |
162162

163163
#### appspec
164164

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ resource "aws_lambda_function" "zip_api" {
254254
layers = var.lambda_layers
255255
timeout = var.timeout
256256
memory_size = var.memory_size
257-
architectures = var.architectures
257+
architectures = [var.architecture]
258258

259259
tracing_config {
260260
mode = var.xray_enabled == true ? "Active" : "PassThrough"
@@ -286,7 +286,7 @@ resource "aws_lambda_function" "docker_api" {
286286
publish = true
287287
timeout = var.timeout
288288
memory_size = var.memory_size
289-
architectures = var.architectures
289+
architectures = [var.architecture]
290290

291291
tracing_config {
292292
mode = var.xray_enabled == true ? "Active" : "PassThrough"

variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ variable "xray_enabled" {
147147
default = false
148148
}
149149

150-
variable "architectures" {
151-
type = list(string)
152-
description = "(Optional) Instruction set architecture for your Lambda function. Valid values are [\"x86_64\"] and [\"arm64\"]. Default is [\"x86_64\"]. Removing this attribute, function's architecture stay the same."
153-
default = ["x86_64"]
150+
variable "architecture" {
151+
type = string
152+
description = "Instruction set architecture for your Lambda function. Valid values are \"x86_64\" and \"arm64\". Default is \"x86_64\"."
153+
default = "x86_64"
154154
}

0 commit comments

Comments
 (0)