Venafi / terraform-provider-venafi

HashiCorp Terraform provider that uses Venafi to streamline machine identity (certificate and key) acquisition.
https://www.terraform.io/docs/providers/venafi/
Mozilla Public License 2.0
16 stars 20 forks source link

TPP Zone not found for deep folder structure #41

Closed jtcarnes closed 3 years ago

jtcarnes commented 3 years ago

PROBLEM SUMMARY When looking to upgrade to 0.11.1, we encountered zone not found everywhere. We have rather deep folders so this might be the issue. 0.10.2 works.

STEPS TO REPRODUCE provider "venafi" { url = "my-companies-tpp" zone = "\VED\Policy\Certificates\Internal\Folder With Spaces\final.zone.folder" }

EXPECTED RESULTS Zones that are deep in the folder structure to be found

ACTUAL RESULTS Error: could not read zone configuration: vcert error: your data contains problems: zone not found

COMMENTS/WORKAROUNDS Version 0.10.2 works, so it's most likely a problem introduced in 0.11

tr1ck3r commented 3 years ago

@jtcarnes we believe this issue was addressed in v0.11.1 (the defect was introduced in v0.11.0) can you please verify that you tested with v0.11.1 and not v0.11.0?

jtcarnes commented 3 years ago

I can confirm that it's a problem for v0.11.1.

tr1ck3r commented 3 years ago

Thank you for confirming @jtcarnes. The issue appears to be not that the folder structure is deep but that you are using the "long form" for the zone. Definitely a 🐛 that we'll work on fixing but, fortunately, there is a straightforward workaround that is also arguably better. When you specify the zone, instead of "\VED\Policy\Certificates\Internal\Folder With Spaces\final.zone.folder" you should specify "Certificates\Internal\Folder With Spaces\final.zone.folder" and everything should work properly with v0.11.1.

rvelaVenafi commented 3 years ago

The issue is related to a method that removes double forward slashes "\" from the zone string before passing it to vcert sdk. This method did not take into consideration the case when the full zone path is passed (\VED\Policy\One\Two) and removed the leading forward slash from the string, resulting in: VED\Policy\One\Two The fix has this case in consideration and appends the forward slash when required.

The fix will be available in next release 0.11.2