ValueError: Fn::GetAtt not allowed to be nested in Fn::Cidr.
Apapora opened this issue · comments
Get the following error:
// Converting master-fullstack.yaml to Terraform!
Traceback (most recent call last):
File "/home/debi/.local/bin/cf2tf", line 8, in
sys.exit(cli())
^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/app.py", line 44, in cli
config = TemplateConverter(tmpl_path.stem, cf_template, search_manger).convert()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 97, in convert
tf_resources = self.convert_to_tf(self.manifest)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 144, in convert_to_tf
tf_resources.extend(converter(resources))
^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 344, in convert_resources
resolved_values = self.resolve_values(
^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 176, in resolve_values
data[key] = self.resolve_values(
^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 206, in resolve_values
value = self.resolve_values(
^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 217, in resolve_values
resolved_list_values = [
^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 218, in
self.resolve_values(item, allowed_func, prev_func) for item in data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 206, in resolve_values
value = self.resolve_values(
^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 217, in resolve_values
resolved_list_values = [
^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 218, in
self.resolve_values(item, allowed_func, prev_func) for item in data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debi/.local/lib/python3.11/site-packages/cf2tf/convert.py", line 204, in resolve_values
raise ValueError(f"{key} not allowed to be nested in {prev_func}.")
ValueError: Fn::GetAtt not allowed to be nested in Fn::Cidr.
Using cf2tf v0.6.2 and the CF file "fullstack-master.yaml" available here: https://github.com/aws-samples/aws-bookstore-demo-app/tree/main/template
When I built this tool, I put these rules in place based on AWS documentation. You can see at the bottom of this page https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-cidr.html That the only functions allowed to be nested inside of Fn::Cidr
are Ref
and Select
. What I have found is that the documentation is pretty much useless.
Thanks for reporting, will have this fixed soon.