Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with live-streaming-on-aws.template #203

Open
tatarevick opened this issue Jul 25, 2023 · 6 comments
Open

Error with live-streaming-on-aws.template #203

tatarevick opened this issue Jul 25, 2023 · 6 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed resource_search_error A CF resource was not correctly translated to Terraform

Comments

@tatarevick
Copy link

tatarevick commented Jul 25, 2023

Hi! There!,

I got my template from this site and just change the extension to yaml.

https://docs.aws.amazon.com/solutions/latest/live-streaming-on-aws/aws-cloudformation-template.html

Download:
https://s3.amazonaws.com/solutions-reference/live-streaming-on-aws/latest/live-streaming-on-aws.template

Thanks! :)

DEPLOY

cf2tf -v DEBUG live-streaming-on-aws.yaml
// Converting live-streaming-on-aws.yaml to Terraform!
debug: // Template location is live-streaming-on-aws.yaml
// Existing Terraform src code found at /tmp/terraform_src.
debug: Parsed the following resources for processing:
debug: {"Parameters": [["InputType", {"Type": "String", "Default": "URL_PULL", "AllowedValues": ["RTP_PUSH", "RTMP_PUSH", "RTMP_PULL", "URL_PULL", "MEDIACONNECT"], "Description": "Specify the input type for MediaLive. Detailed instructions for each input type can be found here https://docs.aws.amazon.com/solutions/latest/live-streaming-on-aws/appendix-a.html"}], ["EncodingProfile", {"Type": "String", "Default": "HD-720p", "AllowedValues": ["HD-1080p", "HD-720p", "SD-540p"], "Description": "Select an encoding profile. HD 1080p [1920x1080, 1280x720, 960x540, 768x432, 640x360, 512x288] HD 720p [1280x720, 960x540, 768x432, 640x360, 512x288] SD 540p [960x540, 768x432, 640x360, 512x288] See the implementation guide for details https://docs.aws.amazon.com/solutions/latest/live-streaming/considerations.html"}], ["InputCIDR", {"Type": "String", "Default": "", "Description": "For RTP and RTMP PUSH input types ONLY, specify the CIDR Block for the MediaLive SecurityGroup. Input security group restricts access to the input and prevents unauthorized third parties from pushing content into a channel that is associated with that input."}], ["PriPullUrl", {"Type": "String", "Default": "https://d15an60oaeed9r.cloudfront.net/live_stream_v2/sports_reel_with_markers.m3u8", "Description": "For URL_PULL and RTMP_PULL input types ONLY, specify the primary source URL."}], ["PriPullUser", {"Type": "String", "Default": "", "Description": "For URL_PULL and RTMP_PULL input types ONLY, specify a username for the primary source URL if basic authentication is enabled on the source."}], ["PriPullPass", {"Type": "String", "Default": "", "Description": "For URL_PULL and RTMP_PULL input types ONLY, specify a password for the primary source URL if basic authentication is enabled on the source.", "NoEcho": true}], ["SecPullUrl", {"Type": "String", "Default": "https://d3h5srgm8b0t83.cloudfront.net/live_stream_v2/sports_reel_with_markers.m3u8", "Description": "For URL_PULL and RTMP_PULL input types ONLY, specify the secondary source URL, this should be a HTTP or HTTPS link to the stream manifest file."}], ["SecPullUser", {"Type": "String", "Default": "", "Description": "For URL_PULL and RTMP_PULL input types ONLY, specify a username for the secondary source URL if basic authentication is enabled on the source."}], ["SecPullPass", {"Type": "String", "Default": "", "Description": "For URL_PULL and RTMP_PULL input types ONLY, specify a password for the secondary source URL if basic authentication is enabled on the source.", "NoEcho": true}], ["PriMediaConnectArn", {"Type": "String", "Default": "", "Description": "For MediaConnect Input type ONLY, specify the ARN for MediaConnect as the primary source. This flow has to be in a different availability zone as the secondary source."}],


ERROR

debug: CDKMetadataAvailable = anytrue([anytrue([data.aws_region.current.name == "af-south-1", data.aws_region.current.name == "ap-east-1", data.aws_region.current.name == "ap-northeast-1", data.aws_region.current.name == "ap-northeast-2", data.aws_region.current.name == "ap-south-1", data.aws_region.current.name == "ap-southeast-1", data.aws_region.current.name == "ap-southeast-2", data.aws_region.current.name == "ca-central-1", data.aws_region.current.name == "cn-north-1", data.aws_region.current.name == "cn-northwest-1"]), anytrue([data.aws_region.current.name == "eu-central-1", data.aws_region.current.name == "eu-north-1", data.aws_region.current.name == "eu-south-1", data.aws_region.current.name == "eu-west-1", data.aws_region.current.name == "eu-west-2", data.aws_region.current.name == "eu-west-3", data.aws_region.current.name == "me-south-1", data.aws_region.current.name == "sa-east-1", data.aws_region.current.name == "us-east-1", data.aws_region.current.name == "us-east-2"]), anytrue([data.aws_region.current.name == "us-west-1", data.aws_region.current.name == "us-west-2"])])
debug: }
debug: Converting 36 Resources
debug: Converting Cloudformation resource MediaLiveRole1149D189 to Terraform.
debug: Converted name to media_live_role1149_d189
debug: Converted CF type AWS::IAM::Role to search term iam role.
debug: Searcing for iam role in terraform docs...
debug: Best match was iam role at /tmp/terraform_src/website/docs/r/iam_role.html.markdown with score of 100.
debug: Found documentation file /tmp/terraform_src/website/docs/r/iam_role.html.markdown
debug: Converted type from AWS::IAM::Role to aws_iam_role
debug: Unable to find section Attributes Reference in /tmp/terraform_src/website/docs/r/iam_role.html.markdown
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/cf2tf/terraform/doc_file.py", line 19, in parse_attributes
attributes = parse_section("Attributes Reference", file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/cf2tf/terraform/doc_file.py", line 37, in parse_section
section_location = find_section(name, file)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/cf2tf/terraform/doc_file.py", line 117, in find_section
raise Exception()
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/bin/cf2tf", line 8, in
sys.exit(cli())
^^^^^
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)

@shadycuz
Copy link
Member

I will take a look.

@tatarevick
Copy link
Author

Thanks! :)

@shadycuz
Copy link
Member

I have found the error, when converting from Cloudformation to Terraform it gets the resource type wrong:

debug: Converted CF type AWS::ServiceCatalogAppRegistry::AttributeGroup to search term service catalog app registry attribute group.
debug: Searcing for service catalog app registry attribute group in terraform docs...
debug: Best match was directory service directory at /tmp/terraform_src/website/docs/r/directory_service_directory.html.markdown with score of 56.
debug: Found documentation file /tmp/terraform_src/website/docs/r/directory_service_directory.html.markdown
debug: Converted type from AWS::ServiceCatalogAppRegistry::AttributeGroup to aws_directory_service_directory

But when I went to look what terraform resource it should be converted to, I couldn't find one. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/servicecatalog_budget_resource_association

Can you find the Terraform equivalent resource? I don't think there is one @tatarevick.

@shadycuz shadycuz added good first issue Good for newcomers help wanted Extra attention is needed resource_search_error A CF resource was not correctly translated to Terraform labels Jul 29, 2023
@shadycuz
Copy link
Member

This is also a duplicate of #113

@shadycuz
Copy link
Member

@tatarevick I don't think so, they don't seem to take the same arguments. Look at the options for the cloudformation resource compared to the terraform one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed resource_search_error A CF resource was not correctly translated to Terraform
Projects
None yet
Development

No branches or pull requests

2 participants