cf2tf
cf2tf copied to clipboard
Add support for SAM resource types like AWS::Serverless::Function
https://github.com/awslabs/aws-api-gateway-developer-portal/blob/main/cloudformation/template.yaml
// Converting aws_cf_template.yaml to Terraform!
[####--------------------------------] 12% 00:03:03 code has been checked out.
Traceback (most recent call last):
File "c:\users\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\appdata\local\programs\python\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\AppData\Local\Programs\Python\Python37\Scripts\cf2tf.exe_main.py", line 9, in
I think I started on this back in December but was distracted by the holidays. I'm taking a fresh look at this now and I have identified the issue.
When I turn on debug logging I see:
debug: Converting the intrinsic functions to Terraform expressions...
debug: Fn::GetAtt - Looking up resource "CatalogUpdaterLambdaFunction"
debug: Converted CF type AWS::Serverless::Function to search term serverless function.
debug: Searcing for serverless function in terraform docs...
debug: Best match was lambda function event invoke config at /tmp/terraform_src/website/docs/r/lambda_function_event_invoke_config.html.markdown with score of 86.
Which basically means the program converted AWS::Serverless::Function
to aws_lambda_function_event_invoke_config
. I'm not sure why it ranked aws_lambda_function_event_invoke_config
higher than aws_lambda_function
but that is the bug.
I will see what I can do to fix this. My worry is that by changing the search algorithm it could break lots of other working stuff. There is a new "override" system that I recently released. I could use it to change AWS::Serverless::Function
to AWS::Lambda::Function
and that might also fix it in this case.
I actually understand this a lot better now... AWS::Serverless::Function
is part of SAM and is not supported yet. I think this is similar to #42 but not quite the same thing.