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

Support regex as CloudFormation schema property format #377

Open
ewbankkit opened this issue Jan 27, 2022 · 1 comment
Open

Support regex as CloudFormation schema property format #377

ewbankkit opened this issue Jan 27, 2022 · 1 comment
Labels
code-generation Relates to the conversion of CloudFormation schema to Terraform schema at buildtime. enhancement

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Jan 27, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Description

JSON Schema allows a string property to have a format value that is a regular expression.
A recent (#378) Terraform schema generation run raised

error generating Terraform awscc_rekognition_collection resource: emitting schema code: Arn has unsupported format: (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:collection\/([a-zA-Z0-9_.\-]+){1,255})

from the CFN schema

        "Arn": {
            "$comment": "Use the `definitions` block to provide shared resource property schemas",
            "type": "string",
            "maxLength": 2048,
            "format": "(^arn:[a-z\\d-]+:rekognition:[a-z\\d-]+:\\d{12}:collection\\/([a-zA-Z0-9_.\\-]+){1,255})"
        },

Temporarily the code that returns the error was commented out.
We should do something better than this:

@ewbankkit ewbankkit added enhancement code-generation Relates to the conversion of CloudFormation schema to Terraform schema at buildtime. labels Jan 27, 2022
@ewbankkit
Copy link
Contributor Author

Pragmatically we can check whether a format pattern is a valid Go regexp pattern and log a warning if it's not and emit a validator if it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-generation Relates to the conversion of CloudFormation schema to Terraform schema at buildtime. enhancement
Projects
None yet
Development

No branches or pull requests

1 participant