terraform-aws-modules / terraform-aws-lambda

Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations πŸ‡ΊπŸ‡¦
https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws
Apache License 2.0
892 stars 662 forks source link

feat: Add a way to define IAM policy name prefix #354

Closed alisson276 closed 1 year ago

alisson276 commented 1 year ago

Description

Allow to give to the policy a name other than the var.role_name

Motivation and Context

Sometimes we want to import things already created by the AWS Console, and the default policy name is AWSLambdaBasicExecutionRole-. So in order to be able to import without recreating the policy this change allow to set a new policy name. The default behavior if var.policy_name is not set is to use role_name exactly how this was doing before this change.

Breaking Changes

I don't think so

How Has This Been Tested?

antonbabenko commented 1 year ago

This PR is included in version 4.4.0 :tada:

monospacesoftware commented 1 year ago

We're experiencing an error with version 4.4.0, appears to be caused by this change:

Error: Error in function call

 on .terraform/modules/lambda_package/iam.tf line 15, in locals:
 15:   policy_name = coalesce(var.policy_name, local.role_name)
   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
   β”‚ while calling coalesce(vals...)
   β”‚ local.role_name is null
   β”‚ var.policy_name is null

Call to function "coalesce" failed: no non-null, non-empty-string
arguments.
antonbabenko commented 1 year ago

2 mins, I will correct it.

github-actions[bot] commented 1 year ago

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.