Importing wafv2 results in incorrect and missing code.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 26
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 22
Description
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:
var importedAcl = new WebAcl("importedAcl", WebAclArgs.builder()
.defaultAction()
...
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 missing action block for the rule.
See below for details steps related to the Java use-case.
Steps to reproduce
- Use the code in this file to deploy a stack that creates a WafV2 ACL:
createWafv2Acl_ts.txt
Note the output of the above program since it provides apulumi importcommand you can use in later steps. - In a separate folder, run
pulumi new aws-javato create a base stack to use for the import. - Run the
pulumi importcommand generated by the create stack in step 1 - Copy/paste the generated code into the program generated in step 2
- Run
pulumi upon the import stack and note the errors. - Modify the import stack code to correctly specify the
.defaultActionblock and to add a required.actionblock to the rule.
See the code in this file for a correct version:
Corrected-Imported_java.txt
Expected 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).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the attached createWafv2Acl_ts.txt and Corrected-Imported_java.txt files, using pulumi import and pulumi convert --language java. Compare the generated Java, TypeScript, and YAML output with the corrected example; done means defaultAction and each rule's action are emitted as valid required blocks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, yaml
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100