stocky-magazine-90066
02/06/2023, 1:38 PMfunc getLambdaFunctionRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "aws_lambda_function",
Notes: []string{"Provisioned concurrency is not yet supported."},
ReferenceAttributes: []string{"function_name"},
CoreRFunc: NewLambdaFunction,
}
}
I then added this to a new resource for provisioned concurrency
func getLambdaProvisionedConcurrencyConfigRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "aws_lambda_provisioned_concurrency_config",
RFunc: NewLambdaProvisionedConcurrencyConfig,
ReferenceAttributes: []string{"aws_lambda_function.function_name"},
}
}
Am I missing something ? Because I'm unable to access this from within the new provisioned concurrency resource. It's empty!!
Any help would be appreciated, I looked at the example here
Example terraform below.
# Add example resources for LambdaProvisionedConcurrencyConfig below
resource "aws_lambda_provisioned_concurrency_config" "lambda_provisioned_concurrency_config" {
function_name = aws_lambda_function.lambda.function_name
provisioned_concurrent_executions = 50
qualifier = aws_lambda_function.lambda.version
}
resource "aws_lambda_function" "lambda" {
function_name = "lambda_function_name"
role = "arn:aws:lambda:us-east-1:account-id:resource-id"
handler = "exports.test"
filename = "function.zip"
runtime = "nodejs12.x"
architectures = ["arm64"]
memory_size = 512
}
little-author-61621
02/06/2023, 1:52 PMaws_lambda_function
or the aws_lambda_provisioned_concurrency_config
?stocky-magazine-90066
02/06/2023, 2:06 PMaws_lambda_provisioned_concurrency_config
as a new resource, but the resource needs some information from aws_lambda_function
which I thought I could do via the reference attributes.little-author-61621
02/06/2023, 2:13 PMaws_lambda_provisioned_concurrency_config
resource:
ReferenceAttributes: []string{"function_name"}
And then this on the aws_lambda_function
resource so it knows to use function_name
as an identifer:
CustomRefIDFunc: func(d *schema.ResourceData) []string {
name := d.Get("function_name").String()
if name != "" {
return []string{name}
}
return nil
}
stocky-magazine-90066
02/06/2023, 2:16 PMlittle-author-61621
02/06/2023, 2:17 PM