|
| 1 | +module "lambda" { |
| 2 | + source = "../../" |
| 3 | + |
| 4 | + prefix = var.prefix |
| 5 | + environment = var.environment |
| 6 | + name = var.name |
| 7 | + |
| 8 | + is_edge = false # Defautl is `false`, If you want to publish to the edge don't forget to override aws's provider to virgina |
| 9 | + |
| 10 | + # If is_edge is `false`, ignore this config |
| 11 | + is_create_lambda_bucket = true # Default is `false`; plz use false, if not 1 lambda: 1 bucket |
| 12 | + bucket_name = "" # If `is_create_lambda_bucket` is `false`; specified this, default is `""` |
| 13 | + |
| 14 | + # Source code |
| 15 | + source_code_dir = "./src" |
| 16 | + file_globs = ["index.js"] |
| 17 | + compressed_local_file_dir = "./outputs" |
| 18 | + |
| 19 | + # Lambda Env |
| 20 | + runtime = "nodejs12.x" |
| 21 | + handler = "index.handler" |
| 22 | + |
| 23 | + # Lambda Specification |
| 24 | + timeout = 3 |
| 25 | + memory_size = 128 |
| 26 | + reserved_concurrent_executions = -1 |
| 27 | + |
| 28 | + # Optional to connect Lambda to VPC |
| 29 | + vpc_config = { |
| 30 | + security_group_ids = ["sg-028f637312eea735e"] |
| 31 | + subnet_ids_to_associate = ["subnet-0b853f8c85796d72d", "subnet-07c068b4b51262793", "subnet-0362f68c559ef7716"] |
| 32 | + } |
| 33 | + dead_letter_target_arn = "arn:aws:sns:ap-southeast-1:557291035693:demo" # To send failed processing to target, Default is `""` |
| 34 | + |
| 35 | + # IAM |
| 36 | + is_create_lambda_role = true # Default is `true` |
| 37 | + lambda_role_arn = "" # If `is_create_lambda_role` is `false` |
| 38 | + # The policies that you want to attach to IAM Role created by only this module # If `is_create_lambda_role` is `false` |
| 39 | + additional_lambda_role_policy_arns = { |
| 40 | + allow_lambda_to_read_s3 = "arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess" |
| 41 | + } |
| 42 | + |
| 43 | + # Resource policy |
| 44 | + lambda_permission_configurations = { |
| 45 | + lambda_on_my_account = { |
| 46 | + pricipal = "apigateway.amazonaws.com" |
| 47 | + source_arn = "arn:aws:execute-api:ap-southeast-1:557291035112:lk36vflbha/*/*/" |
| 48 | + } |
| 49 | + lambda_on_my_another_account_wrong = { |
| 50 | + pricipal = "apigateway.amazonaws.com" |
| 51 | + source_arn = "arn:aws:execute-api:ap-southeast-1:224563527112:q6pwa6wgr6/*/*/" |
| 52 | + source_account = "557291035112" |
| 53 | + } |
| 54 | + lambda_on_my_another_account_correct = { |
| 55 | + pricipal = "apigateway.amazonaws.com" |
| 56 | + source_arn = "arn:aws:execute-api:ap-southeast-1:557291035112:wpj4t3scmb/*/*/" |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + # Logging |
| 61 | + is_create_cloudwatch_log_group = true # Default is `true` |
| 62 | + cloudwatch_log_retention_in_days = 90 # Default is `90` |
| 63 | + |
| 64 | + # Env |
| 65 | + ssm_params = {} |
| 66 | + plaintext_params = { |
| 67 | + region = "ap-southeast-1" |
| 68 | + cluster_name = "oozou-dev-test-schedule-cluster" |
| 69 | + nodegroup_name = "oozou-dev-test-schedule-custom-nodegroup" |
| 70 | + min = 1, |
| 71 | + max = 1, |
| 72 | + desired = 1 |
| 73 | + } |
| 74 | + |
| 75 | + tags = var.custom_tags |
| 76 | +} |
0 commit comments