Open dinvlad opened 4 years ago
See: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/lambda_invocation for the AWS equivalent.
This is often used for fetching data or resources terraform cannot natively support:
data "aws_lambda_invocation" "data_terraform_cant_get" {
function_name = "myfunction"
}
output "mydata" {
value = data.aws_lambda_invocation.data_terraform_cant_get.result
}
resource "other_resource" "other" {
resource_argument = data.aws_lambda_invocation.data_terraform_cant_get.result
}
Note from triage: Moving out of backlog due to prior art in the AWS provider, but the documentation for this new data source should warn that the Cloud Function shouldn't have side effects. This data source heavily depends on what the CF does.
Community Note
Description
Cloud Functions API exposes
projects.locations.functions.call
method to synchronously invoke a function for testing purposes [1].Having an ability to do that from inside a Terraform template would significantly raise extensibility of the provider, including an ability to:
This would also mirror similar functionality in other providers and systems, e.g.
aws_lambda_invocation
orAWS::CloudFormation::CustomResource
.New or Affected Resource(s)
google_cloudfunctions_function_call
Potential Terraform Configuration
References