pulumi / pulumi-aws

An Amazon Web Services (AWS) Pulumi resource package, providing multi-language access to AWS
Apache License 2.0
429 stars 151 forks source link

Error when trying to import aws.wafv2.WebAcl #2854

Open sandervb2 opened 9 months ago

sandervb2 commented 9 months ago

What happened?

Normally after successfully importing a resource i get the python code to add to my program but when I tried to import a aws.wafv2.WebAcl resource, I got the following error:

({
  name: string,
  priority: 1,
  statement: { ipSetReferenceStatement: { arn: string } },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 2,
  statement: {
    ipSetReferenceStatement: {
      arn: string,
      ipSetForwardedIpConfig: {
        fallbackBehavior: string,
        headerName: string,
        position: string,
      },
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 13,
  statement: {
    sizeConstraintStatement: {
      comparisonOperator: string,
      fieldToMatch: 
        { body: { oversizeHandling: string } },
      size: 16384,
      textTransformations: (
        { priority: 0, type: string }
      ),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 14,
  statement: {
    sizeConstraintStatement: {
      comparisonOperator: string,
      fieldToMatch: {
        jsonBody: {
          matchPattern: {},
          matchScope: string,
          oversizeHandling: 
            string,
        },
      },
      size: 16384,
      textTransformations: (
        { priority: 0, type: string }
      ),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 900,
  statement: {
    orStatement: {
      statements: ({
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: 
              {
                name: 
                  string,
              }
          },
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: 
              {
                name: 
                  string,
              }
          },
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: 
              {
                name: 
                  string,
              }
          },
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: 
              {
                name: 
                  string,
              }
          },
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: 
              {
                name: 
                  string,
              }
          },
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: 
              {
                name: 
                  string,
              }
          },
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          fieldToMatch: {
            singleHeader: 
              {
                name: 
                  string,
              }
          },
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      }),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 800,
  statement: { geoMatchStatement: { countryCodes: (string, string, string, string, string) } },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 801,
  statement: {
    geoMatchStatement: {
      countryCodes: (string, string, string, string, string),
      forwardedIpConfig: {
        fallbackBehavior: string,
        headerName: string,
      },
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 101,
  statement: { ipSetReferenceStatement: { arn: string } },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 102,
  statement: {
    ipSetReferenceStatement: {
      arn: string,
      ipSetForwardedIpConfig: {
        fallbackBehavior: string,
        headerName: string,
        position: string,
      },
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 200,
  statement: {
    andStatement: {
      statements: ({
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      }),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 11,
  statement: {
    sizeConstraintStatement: {
      comparisonOperator: string,
      fieldToMatch: {
        cookies: {
          matchPatterns: ({}),
          matchScope: string,
          oversizeHandling: 
            string,
        },
      },
      size: 8192,
      textTransformations: (
        { priority: 0, type: string }
      ),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 12,
  statement: {
    sizeConstraintStatement: {
      comparisonOperator: string,
      fieldToMatch: {
        headers: ({
          matchPattern: {},
          matchScope: string,
          oversizeHandling: 
            string,
        }),
      },
      size: 8192,
      textTransformations: (
        { priority: 0, type: string }
      ),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 700,
  statement: {
    orStatement: {
      statements: ({
        byteMatchStatement: {
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      },
      {
        byteMatchStatement: {
          positionalConstraint: 
            string,
          searchString: string,
          textTransformations: (
            {
              priority: 
                0,
              type: 
                string,
            }
          ),
        },
      }),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 300,
  statement: {
    andStatement: {
      statements: ({
        orStatement: {
          statements: ({
            sqliMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                fieldToMatch: 
                  {
                    body: 
                      {
                        oversizeHandling: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                fieldToMatch: 
                  {
                    body: 
                      {
                        oversizeHandling: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                fieldToMatch: 
                  {
                    singleHeader: 
                      {
                        name: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                fieldToMatch: 
                  {
                    singleHeader: 
                      {
                        name: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                fieldToMatch: 
                  {
                    singleHeader: 
                      {
                        name: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            sqliMatchStatement: 
              {
                fieldToMatch: 
                  {
                    singleHeader: 
                      {
                        name: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      }),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
},
{
  name: string,
  priority: 600,
  statement: {
    andStatement: {
      statements: ({
        orStatement: {
          statements: ({
            xssMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            xssMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            xssMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            xssMatchStatement: 
              {
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            xssMatchStatement: 
              {
                fieldToMatch: 
                  {
                    body: 
                      {
                        oversizeHandling: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            xssMatchStatement: 
              {
                fieldToMatch: 
                  {
                    body: 
                      {
                        oversizeHandling: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            xssMatchStatement: 
              {
                fieldToMatch: 
                  {
                    singleHeader: 
                      {
                        name: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          },
          {
            xssMatchStatement: 
              {
                fieldToMatch: 
                  {
                    singleHeader: 
                      {
                        name: 
                          string,
                      }
                  }
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      },
      {
        notStatement: {
          statements: ({
            byteMatchStatement: 
              {
                positionalConstraint: 
                  string,
                searchString: 
                  string,
                textTransformations: 
                  ({
                    priority: 
                      0,
                    type: 
                      string,
                  })
              }
          }),
        },
      }),
    },
  },
  visibilityConfig: {
    cloudwatchMetricsEnabled: true,
    metricName: string,
    sampledRequestsEnabled: true,
  },
}) to location of type   list(  {
      action:   {
          allow:   {
              customRequestHandling:   {
                  insertHeaders:   list(  {
                        name: 
                            output(
                              string
                            )
                          | string
                        value: 
                            output(
                              string
                            )
                          | string
                      }
                    | output(
                        {
                          name: 
                            string,
                          value: 
                            string,
                        }
                      ))
                  | output(list(
                      {
                        name: 
                          string,
                        value: 
                          string,
                      }
                    )),
                }
              | output({
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                })?,
            }
          | output({
              customRequestHandling:   {
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                }?,
            })?,
          block:   {
              customResponse:   {
                  customResponseBodyKey:   output(
                      string
                    )
                  | string?,
                  responseCode: int | output(int),
                  responseHeaders:   list(  {
                        name: 
                            output(
                              string
                            )
                          | string
                        value: 
                            output(
                              string
                            )
                          | string
                      }
                    | output({
                        name: 
                          string,
                        value: 
                          string,
                      }))
                  | output(list({
                      name: 
                        string,
                      value: 
                        string,
                    }))?,
                }
              | output({
                  customResponseBodyKey: 
                    string?,
                  responseCode: int,
                  responseHeaders:   list({
                      name: 
                        string,
                      value: 
                        string,
                    })?,
                })?,
            }
          | output({
              customResponse:   {
                  customResponseBodyKey: 
                    string?,
                  responseCode: int,
                  responseHeaders:   list({
                      name: 
                        string,
                      value: 
                        string,
                    })?,
                }?,
            })?,
          captcha:   {
              customRequestHandling:   {
                  insertHeaders:   list(  {
                        name: 
                            output(
                              string
                            )
                          | string
                        value: 
                            output(
                              string
                            )
                          | string
                      }
                    | output(
                        {
                          name: 
                            string,
                          value: 
                            string,
                        }
                      ))
                  | output(
                      list({
                        name: 
                          string,
                        value: 
                          string,
                      })
                    ),
                }
              | output({
                  insertHeaders: list(
                    {
                      name: 
                        string,
                      value: 
                        string,
                    }
                  ),
                })?,
            }
          | output({
              customRequestHandling:   {
                  insertHeaders: list(
                    {
                      name: 
                        string,
                      value: 
                        string,
                    }
                  ),
                }?,
            })?,
          challenge:   {
              customRequestHandling:   {
                  insertHeaders:   list(  {
                        name: 
                            output(
                              string
                            )
                          | string
                        value: 
                            output(
                              string
                            )
                          | string
                      }
                    | output(
                        {
                          name: 
                            string,
                          value: 
                            string,
                        }
                      ))
                  | output(
                      list({
                        name: 
                          string,
                        value: 
                          string,
                      })
                    ),
                }
              | output({
                  insertHeaders: 
                    list({
                      name: 
                        string,
                      value: 
                        string,
                    })
                })?,
            }
          | output({
              customRequestHandling:   {
                  insertHeaders: 
                    list({
                      name: 
                        string,
                      value: 
                        string,
                    })
                }?,
            })?,
          count:   {
              customRequestHandling:   {
                  insertHeaders:   list(  {
                        name: 
                            output(
                              string
                            )
                          | string
                        value: 
                            output(
                              string
                            )
                          | string
                      }
                    | output(
                        {
                          name: 
                            string,
                          value: 
                            string,
                        }
                      ))
                  | output(list(
                      {
                        name: 
                          string,
                        value: 
                          string,
                      }
                    )),
                }
              | output({
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                })?,
            }
          | output({
              customRequestHandling:   {
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                }?,
            })?,
        }
      | output({
          allow:   {
              customRequestHandling:   {
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                }?,
            }?,
          block:   {
              customResponse:   {
                  customResponseBodyKey: 
                    string?,
                  responseCode: int,
                  responseHeaders:   list({
                      name: 
                        string,
                      value: 
                        string,
                    })?,
                }?,
            }?,
          captcha:   {
              customRequestHandling:   {
                  insertHeaders: list(
                    {
                      name: 
                        string,
                      value: 
                        string,
                    }
                  ),
                }?,
            }?,
          challenge:   {
              customRequestHandling:   {
                  insertHeaders: 
                    list({
                      name: 
                        string,
                      value: 
                        string,
                    })
                }?,
            }?,
          count:   {
              customRequestHandling:   {
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                }?,
            }?,
        })?,
      captchaConfig:   {
          immunityTimeProperty:   { immunityTime: int | output(int)? }
          | output({ immunityTime: int? })?,
        }
      | output({ immunityTimeProperty: { immunityTime: int? }? })?,
      name: output(string) | string,
      overrideAction:   { count: {} | output({})?, none: {} | output({})? }
      | output({ count: {}?, none: {}? })?,
      priority: int | output(int),
      ruleLabels:   list({ name: output(string) | string } | output({ name: string }))
      | output(list({ name: string }))?,
      statement: 'T1 | output('T2),
      visibilityConfig:   {
          cloudwatchMetricsEnabled: bool | output(bool),
          metricName: output(string) | string,
          sampledRequestsEnabled: bool | output(bool),
        }
      | output({
          cloudwatchMetricsEnabled: bool,
          metricName: string,
          sampledRequestsEnabled: bool,
        }),
    }
  | output({
      action:   {
          allow:   {
              customRequestHandling:   {
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                }?,
            }?,
          block:   {
              customResponse:   {
                  customResponseBodyKey: 
                    string?,
                  responseCode: int,
                  responseHeaders:   list({
                      name: 
                        string,
                      value: 
                        string,
                    })?,
                }?,
            }?,
          captcha:   {
              customRequestHandling:   {
                  insertHeaders: list(
                    {
                      name: 
                        string,
                      value: 
                        string,
                    }
                  ),
                }?,
            }?,
          challenge:   {
              customRequestHandling:   {
                  insertHeaders: 
                    list({
                      name: 
                        string,
                      value: 
                        string,
                    })
                }?,
            }?,
          count:   {
              customRequestHandling:   {
                  insertHeaders: list({
                    name: 
                      string,
                    value: 
                      string,
                  }),
                }?,
            }?,
        }?,
      captchaConfig: { immunityTimeProperty: { immunityTime: int? }? }?,
      name: string,
      overrideAction: { count: {}?, none: {}? }?,
      priority: int,
      ruleLabels: list({ name: string })?,
      statement: 'T2,
      visibilityConfig: {
        cloudwatchMetricsEnabled: bool,
        metricName: string,
        sampledRequestsEnabled: bool,
      },
    }))
| output(list({
    action:   {
        allow:   {
            customRequestHandling:   {
                insertHeaders: list({
                  name: 
                    string,
                  value: 
                    string,
                }),
              }?,
          }?,
        block:   {
            customResponse:   {
                customResponseBodyKey: string?,
                responseCode: int,
                responseHeaders:   list({
                    name: 
                      string,
                    value: 
                      string,
                  })?,
              }?,
          }?,
        captcha:   {
            customRequestHandling:   {
                insertHeaders: list({
                  name: 
                    string,
                  value: 
                    string,
                }),
              }?,
          }?,
        challenge:   {
            customRequestHandling:   {
                insertHeaders: list(
                  {
                    name: 
                      string,
                    value: 
                      string,
                  }
                ),
              }?,
          }?,
        count:   {
            customRequestHandling:   {
                insertHeaders: list({
                  name: 
                    string,
                  value: 
                    string,
                }),
              }?,
          }?,
      }?,
    captchaConfig: { immunityTimeProperty: { immunityTime: int? }? }?,
    name: string,
    overrideAction: { count: {}?, none: {}? }?,
    priority: int,
    ruleLabels: list({ name: string })?,
    statement: 'T2,
    visibilityConfig: {
      cloudwatchMetricsEnabled: bool,
      metricName: string,
      sampledRequestsEnabled: bool,
    },
  }))?: ; 

Example

I used the following command to import the WebAcl resource:

 pulumi import aws:wafv2/webAcl:WebAcl <resource_name> <webacl-id>/<webacl-name>/REGIONAL

Output of pulumi about

Backend        
Name           <my-backend-name>
URL            <my-s3-backed-url>
User           <my-user>
Organizations  
Token type     personal

Dependencies:
NAME        VERSION
boto3       1.28.53
fabric      3.2.2
pip         22.3.1
psutil      5.9.5
pulumi-aws  6.4.0
requests    2.31.0
setuptools  65.5.1
wheel       0.38.4

Pulumi locates its logs in /tmp by default

Additional context

I noticed that the import function in the api docs for the wafv2.WebAcl is not there (anymore?) After selecting yes at the prompt to confirm the WebAcl import, I received the following warnings:

Do you want to perform this import? yes
Importing (<stack_name>):
     Type                 Name                    Status               Info
     pulumi:pulumi:Stack  <stack_name>                       
 =   └─ aws:wafv2:WebAcl  <resource_name>  imported (0.08s)     5 warnings

Diagnostics:
  aws:wafv2:WebAcl (<resource_name>):
    warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `aws` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
    warning: aws:wafv2/webAcl:WebAcl resource '<resource_name>' has a problem: expected rule.13.statement.0.and_statement.0.statement.0.or_statement.0.statement.4.sqli_match_statement.0.field_to_match.0.body.0.oversize_handling to be one of ["CONTINUE" "MATCH" "NO_MATCH"], got . Examine values at '<resource_name>.rules'.
    warning: aws:wafv2/webAcl:WebAcl resource '<resource_name>' has a problem: expected rule.13.statement.0.and_statement.0.statement.0.or_statement.0.statement.5.sqli_match_statement.0.field_to_match.0.body.0.oversize_handling to be one of ["CONTINUE" "MATCH" "NO_MATCH"], got . Examine values at '<resource_name>.rules'.
    warning: aws:wafv2/webAcl:WebAcl resource '<resource_name>' has a problem: expected rule.14.statement.0.and_statement.0.statement.0.or_statement.0.statement.4.xss_match_statement.0.field_to_match.0.body.0.oversize_handling to be one of ["CONTINUE" "MATCH" "NO_MATCH"], got . Examine values at '<resource_name>.rules'.
    warning: aws:wafv2/webAcl:WebAcl resource '<resource_name>' has a problem: expected rule.14.statement.0.and_statement.0.statement.0.or_statement.0.statement.5.xss_match_statement.0.field_to_match.0.body.0.oversize_handling to be one of ["CONTINUE" "MATCH" "NO_MATCH"], got . Examine values at '<resource_name>.rules'.

Resources:
    = 1 imported
    752 unchanged

Duration: 4s

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

mikhailshilkov commented 9 months ago

@Frassle Can you help me read this message? Why have we printed this diagnostics?

Frassle commented 9 months ago

The first message is from codegen, that it can't assign an expression of one shape to a location of another (there's a "to location of type" hidden in the middle of that long message).

Now that's probably a Read bug, because I'd expect the shape of date returned from Read to match the schema shape. But it's probably an import/codegen bug as well because we should be tolerant to bad Read implementations. I think we could warn that the types don't match but we should still try and write out the best guess of the code.

The warnings after:

 warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `aws` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
    warning: aws:wafv2/webAcl:WebAcl resource '<resource_name>' has a problem: expected rule.13.statement.0.and_statement.0.statement.0.or_statement.0.statement.4.sqli_match_statement.0.field_to_match.0.body.0.oversize_handling to be one of ["CONTINUE" "MATCH" "NO_MATCH"], got . Examine values at '<resource_name>.rules'.
...

Are that after we got the data from Read we passed it back to Check, and Check reported those failures. This is just a provider bug, either in Read or Check (or both).

t0yv0 commented 2 months ago

It's difficult to read such a long type printout, but it could be that it's failing to match null against the expected type as in https://github.com/pulumi/pulumi-aws/issues/2534 - if the root-cause is the same, that'd be an error because in TF null may populate every type; even when bridged providers emit required signatures for output properties to emit SDKs that are not projecting as Optional to the runtime, these may and will be populated by null in certain situations.

The other ticket that may be relevant here is https://github.com/pulumi/pulumi-terraform-bridge/issues/1225 where we're not running validators in the same order as TF would.

t0yv0 commented 2 months ago

It would be a great help if we had a quick repro here I could try some possible fixes on, much appreciated.