Garden validate fails upon checking templated vari...
# 🌱|help-and-getting-started
m
After doing some tests with the terraform plugin and not understanding why ''garden validate" failed, I finally discovered that the command runs checks on the actual values of the templated variables for ${actions.deploy.[action-name].outputs} while validating the garden config. Because of this, in the event that the validate step is run before the terraform plugin apply-action step is done, the validate step will fail regardless if the garden configuration is correct. This issue was not present in 0.12. Please take a look at this as soon as possible.
As proof of the issue, allow me to present some log comparisons.
Validate pre-apply
Copy code
$ garden validate --env=dev --yes
...
β„Ή deploy.pricing-pg-backup  β†’ Aborting because upstream dependency failed.
β„Ή deploy.a-pricing        β†’ Aborting because upstream dependency failed.
β„Ή run.pricing-migrate       β†’ Aborting because upstream dependency failed.
β„Ή run.pricing-reseed        β†’ Aborting because upstream dependency failed.
βœ– deploy.pricing-pg         β†’ Failed processing resolve Deploy type=helm name=pricing-pg (took 6.65 sec). This is what happened:

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
Invalid template string (${actions.deploy.infrastructure-aw…): Could not find key pricing_db_password under actions.deploy.infrastructure-aws.outputs. Available keys: (none).
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
Failed to resolve Deploy type=helm name=b-pg: Error: resolve Deploy type=helm name=b-pg failed: Error: Invalid template string (${actions.deploy.infrastructure-aw…): Could not find key b_db_password under actions.deploy.infrastructure-aws.outputs. Available keys: (none).
Validate post-apply
Copy code
βœ– run.a-config-reseed     β†’ Failed processing resolve Run type=kubernetes-pod name=a-config-reseed (took 8.9 sec). This is what happened:

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
Invalid template string (${actions.deploy.infrastructure-aw…): Could not find key access_key under actions.deploy.infrastructure-aws.outputs. Available keys: b_client_registry, b_db_password, b_s3_document, b_s3_export, b_server_registry, keycloak_admin_password, keycloak_db_password, keycloak_registry, a_client_registry, a_db_password, a_pricing_registry, a_s3_document, a_s3_export, a_s3_pricing_backup, a_server_registry and pricing_db_password.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
Failed to resolve Run type=kubernetes-pod name=b-migrate: Error: resolve Run type=kubernetes-pod name=b-migrate failed: Error: Invalid template string (${actions.deploy.infrastructure-aw…): Could not find key access_key under actions.deploy.infrastructure-aws.outputs. Available keys: b_client_registry, b_db_password, b_s3_document, b_s3_export, b_server_registry, keycloak_admin_password, keycloak_db_password, keycloak_registry, a_client_registry, a_db_password, a_pricing_registry, a_s3_document, a_s3_export, a_s3_pricing_backup, a_server_registry and pricing_db_password.
Based on these 2 outputs, it's clear that the validate step is not working like it was previously doing as for our current production Gitlab CI pipeline which is on garden 0.12, the validate step does not check the variable for the output values to be present. Now with 0.13 this has changed to being the validate step checking not just syntax but if the values exist as well which interferes with just the syntax checking. Was this change intended? If this is so, having templated values for terraform outputs without applying the plan to the garden deployment before actually deploying will make validating the configuration pointless as it will just be false positives.
f
Hi @many-pizza-75746 , this looks like a bug! Would you file an issue on GitHub for this so we can get this addressed? https://github.com/garden-io/garden/issues
m
Hi Anna, I just raised the bug report here. https://github.com/garden-io/garden/issues/5695
Thank you for your time
f
Thank you!
s
Hi @freezing-pharmacist-34446, Has there been any updates on this bug report yet?
s
I've just opened a PR for this: https://github.com/garden-io/garden/pull/5809
16 Views