简体   繁体   中英

Terraform equiv to Custom::LoadLambda in CloudFormation

I know the equivalent to AWS::Lambda::Function is aws_lambda_function

But I'm not sure what the equiv for Custom::LoadLambda

I'm trying to translate the below into Terraform:

CreateRsaKey:
    Type: Custom::LoadLambda
    Properties:
      ServiceToken: # This seems to call another lambda
        Fn::GetAtt:
        - SolutionHelper
        - Arn
      Region:
        Ref: AWS::Region

The Custom::String Resource Type refers to a Custom Resource . This means that what it does depends on the particular implementation of the Lambda function provided to the ServiceToken property ( SolutionHelper in your example). When a Custom Resource is used, the Lambda function is invoked with a Request Object specifying a RequestType of Create / Update / Delete .

The Terraform equivalent of a Custom Resource is a Custom Provider plugin. These are packaged and distributed the same as the standard set of Providers, only less officially. They are built as separate binaries (typically Go packages) auto-discovered by the core Terraform process using a filename convention ( terraform-<TYPE>-<NAME> ), and are invoked in a subprocess using a custom RPC mechanism . The plugin binary provides through RPC a Provider containing a collection of Resource s that implement Create / Read / Update / Delete functions for the resource.

So it's possible to re-implement the functionality of a Lambda-backed Custom Resource within a Terraform Provider Plugin by translating the CloudFormation Create / Update / Delete logic in the Lambda function to the Create / Update / Delete functions in the Terraform Resource (and adding an appropriate Read function). However, it's not a very simple or straightforward process.

您可以尝试使用此提供程序https://github.com/mobfox/terraform-provider-multiverse

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM