Open MitchellGerdisch opened 1 year ago
Please note that using work around as provided by the Pulumi team, namely initializing WebAcl with
WebAclArgs.builder() .defaultAction(WebAclDefaultActionArgs.builder() .allow(WebAclDefaultActionAllowArgs.builder() .build()) .build())
And each rule with
.action(WebAclRuleActionArgs.builder() .block(WebAclRuleActionBlockArgs.builder() .build()) .build())
Results with:
{ RespMetadata: { StatusCode: 400, RequestID: "2706f15a-6f1c-465e-a79f-ef5509d06735" }, Field: "RULE", Message_: "Error reason: A reference in your rule statement is not valid., field: RULE, parameter: Statement", Parameter: "Statement", Reason: "A reference in your rule statement is not valid."
The original code has been generated with the pulumi import.
Thanks & Regards,
Whizzy
What happened?
Imported WafV2 ACL into Java and although the resource imported into state successfully, the generated code had errors.
Specifically, it generated code like this:
Where
.defaultAction() is not valid. Similarly for the rules section (not shown above) it was missing a
.action()` block which is needed for the code to work.Note: Importing to Typescript and YAML also produced incorrect code for the analogous
defaultAction
block and missingaction
block for the rule.See below for details steps related to the Java use-case.
Steps to reproduce
pulumi import
command you can use in later steps.pulumi new aws-java
to create a base stack to use for the import.pulumi import
command generated by the create stack in step 1pulumi up
on the import stack and note the errors..defaultAction
block and to add a required.action
block to the rule. See the code in this file for a correct version: Corrected-Imported_java.txtExpected Behavior
The generated import code should correctly specify all required properties.
Actual Behavior
The generated import code incorrectly specified
.defaultAction
and was missing the rule-level.action
property altogether.Output of
pulumi about
CLI
Version 3.51.1 Go Version go1.19.4 Go Compiler gc
Plugins NAME VERSION aws 5.27.0 java unknown
Host
OS darwin Version 12.5.1 Arch x86_64
This project is written in java: executable='/usr/bin/java' version='java 19.0.2 2023-01-17 Java(TM) SE Runtime Environment (build 19.0.2+7-44) Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)' gradle='7.4.2' java='/usr/bin/java' javac='19.0.2' maven='Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)'
Current Stack: xxxxxx/import-java-2/dev
TYPE URN pulumi:pulumi:Stack urn:pulumi:dev::import-java-2::pulumi:pulumi:Stack::import-java-2-dev pulumi:providers:aws urn:pulumi:dev::import-java-2::pulumi:providers:aws::default_5_27_0 aws:wafv2/webAcl:WebAcl urn:pulumi:dev::import-java-2::aws:wafv2/webAcl:WebAcl::importedAcl
Found no pending operations associated with dev
Backend
Name pulumi.com
No dependencies found
Additional context
I noticed that running
pulumi convert --language java
for a properly defined yaml version of the code would produce better but still incorrect version of the java code.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).