Bug: sam build --hook-name terraform --beta-features command fails: SAM CLI doesnot supporting Lambda aliases in API gatway
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Description:
We have terraform script where it creates API gateway (with child, grand child and parent relations ship) and Lambda functions. This Also requirement is to use Aliases for lambda function and create multi version API gateway.
However whenver we run sam build comand gives following error,
Error: An error occurred when attempting to link two resources: Could not use the value aws_lambda_alias.publish_book_review_alias_refresh.invoke_arn as a destination for the source resource aws_api_gateway_integration.api_integration. The expected destination resources should be of destination resource type aws_lambda_function. using invoke_arn property.
SAM CLI doesnot supporting Lambda aliases in API gatway;
SAM CLI DOESNOT UNDERSTAND aws_lambda_alias.publish_book_review_alias_refresh.invoke_arn
### Steps to reproduce:
Create API Gateway with parent->child->grandchild relations ship
Create Lambda function and intergrate same lambda function with all API's
Execute following command,
sam build --hook-name terraform --beta-features --debug
### Observed result:
Gives folloqwing error,
aws_lambda_alias.publish_book_review_alias_refresh.invoke_arn as a destination for the source resource aws_api_gateway_integration.api_integration. The expected destination resources should be of destination resource type aws_lambda_function. using invoke_arn property.
### Expected result:
LABMDA ALIASES INTEGRATED WITH API GATWAY WORKS IN ALL SCENARIO'S. SHOULD WORK WITH SAM CLI ALSO.
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: WINDOWS
2. `sam --version`:1.97.0
3. AWS region:aws-cli/2.1.11 Python/3.7.9 Windows/10 exe/AMD64 prompt/off
```
# Paste the output of `sam --info` here
```
{
"version": "1.97.0",
"system": {
"python": "3.8.8",
"os": "Windows-10-10.0.19041-SP0"
},
"additional_dependencies": {
"docker_engine": "20.10.17",
"aws_cdk": "Not available",
"terraform": "1.5.3"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
`Add --debug flag to command you are running`

Contributor guide
Assessment
This issue has not been assessed yet.