terraform-cdk
                                
                                 terraform-cdk copied to clipboard
                                
                                    terraform-cdk copied to clipboard
                            
                            
                            
                        Test existence of Providers with properties
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
Description
I have a stack that generates a lot of providers. I would like to write tests to ensure they exist and were created with specific properties. This doesn't appear possible atm. It would be good to have something similar to toHaveResourceWithProperties but for providers. Please correct me if this is indeed possible.
To clarify: You want to test the generated provider bindings itself, or the instantiated provider in a stack? I'm assuming you're using Typescript?
I want to test the instantiated providers in a stack. I ended up parsing the rendered Terraform json and validating it that way. But feels like there should be a prettier way.
@coen-hyde @ansgarm I am new to community. Can you just throw some light on this issue ? I am interested in working on it.
@aayushharwani-aidash This would be adding additional testing capabilities. Take a look here for more information on testing.
Technically this involves adding another function similar to this one, but for looking at the provider and maybe terraform.required_providers sections of the synthesized output:
https://github.com/hashicorp/terraform-cdk/blob/a3338f49abc001dafe35833511392f45553b1a61/packages/cdktf/lib/testing/matchers.ts#L151
We would also want to update the testing docs to include the new functions.
I understood issue. I am interested to work on it but not getting where to start. Will anyone like to help me ? @jsteinich @ansgarm @skorfmann
I understood issue. I am interested to work on it but not getting where to start. Will anyone like to help me ? @jsteinich @ansgarm @skorfmann
Are you in the cdk dev slack? You could ask specific questions in the terraform-cdk channel.
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.