I've scoured the Terraform docs for the AWS provider and couldn't find support for CloudFormation::CustomResource in terraform.
I've created my Lambda Functions and now I would like to pass my arguments to my lambda function. The way this is done in CloudFormation is via a custom resource.
I however can't seem to find support for this in Terraform. Am I missing something?
Thanks.
Best Answer
The
aws_cloudformation_stack
resource allows the creation of CloudFormation stacks in Terraform, thus exposing all of CloudFormation's features within a Terraform configuration:The
Type
attribute here can be any string starting withCustom::
. TheServiceToken
identifies which custom resource provider will handle this custom resource. Any other properties that the custom resource supports can be provided as additional attributes in theProperties
object.Since the format of
template_body
is just a standard CloudFormation template, the documentation forCustomResource
gives the full details on how this feature works.Terraform does not directly support CloudFormation custom resources as a native Terraform resource, but the
aws_cloudformation_stack
resource is provided as a way to get the best of both worlds, giving access to CloudFormation-specific features when needed.