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

Recursive attribute definitions #95

Open
ewbankkit opened this issue Aug 12, 2021 · 4 comments
Open

Recursive attribute definitions #95

ewbankkit opened this issue Aug 12, 2021 · 4 comments
Labels
code-generation Relates to the conversion of CloudFormation schema to Terraform schema at buildtime. resource-suppression Issue that prevents a resource from being generated. upstream-terraform

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Aug 12, 2021

AWS::WAFv2::RuleGroup and AWS::WAFv2::WebACL have recursive attribute definitions such as

"Statement": {
    "properties": {
        "AndStatement": {
            "$ref": "#/definitions/AndStatement"
        },
    }
}

"AndStatement": {
    "properties": {
      "Statements": {
        "type": "array",
        "items": {
          "$ref": "#/definitions/Statement"
        }
      }
    }
}

which lead to Go panics during Terraform schema code generation.
For now we are not generating these resources but we should attempt to solve by capping the number of levels of recursion as we do in the current provider: https://github.com/hashicorp/terraform-provider-aws/blob/main/aws/resource_aws_wafv2_web_acl.go#L131.

Relates:

@ewbankkit ewbankkit added the code-generation Relates to the conversion of CloudFormation schema to Terraform schema at buildtime. label Aug 12, 2021
@kadrach
Copy link
Contributor

kadrach commented Jun 26, 2023

Affects AWS::Lex::Bot, see #1018.

@breathingdust
Copy link
Member

breathingdust commented Apr 3, 2024

Also affects the following:

awscc_amplifyuibuilder_component
awscc_amplifyuibuilder_form
awscc_amplifyuibuilder_theme
awscc_iottwinmaker_component_type
awscc_iottwinmaker_entity
awscc_wafv2_rule_group
awscc_wafv2_web_acl
awscc_connect_evaluation_form
awscc_emrserverless_application
awscc_lex_bot

We can likely cap the number of levels of recursion and/or expose a property to let it be set as a json blob.

@ewbankkit ewbankkit added the resource-suppression Issue that prevents a resource from being generated. label Apr 9, 2024
@breathingdust
Copy link
Member

Terraform as a language does not offer a way to model recursive attribute definitions in the schema so we are limited in what options we have to resolve this. This limitation also applies to the standard provider, and in that case depending on the resource, we have had some success in either limiting the levels of recursion in order to offer partial support, or accepting a json blob instead which allows full support of configuration at the cost of user experience. For the Cloud Control provider however, we do not really have adequate information available to us in the schema to decide if either workaround would be appropriate when we generate the resource.

At this time we have no viable way forward to unsuppress these resources.

@breathingdust
Copy link
Member

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. resource-suppression Issue that prevents a resource from being generated. upstream-terraform
Projects
None yet
Development

No branches or pull requests

3 participants