Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Resource Plan Validation Funcion ValidatePlan #1103

Closed
zliang-akamai opened this issue Feb 27, 2025 · 2 comments
Closed

Add Resource Plan Validation Funcion ValidatePlan #1103

zliang-akamai opened this issue Feb 27, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@zliang-akamai
Copy link
Contributor

The framework only support ValidateConfig function for now, and in some cases, a non-computed attributes may still be an unknown value in the config value during validation time.

Having a ValidatePlan function may solve this problem.

@zliang-akamai zliang-akamai added the enhancement New feature or request label Feb 27, 2025
@austinvalle
Copy link
Member

austinvalle commented Mar 7, 2025

Hey there @zliang-akamai 👋🏻 ,

It's true that validation in Terraform can receive configuration values that are unknown (for example, if you're running terraform validate and referencing a new resource's attribute that is computed). However, Terraform guarantees to eventually call validation with a fully known config before applying the resource.

So if you were running terraform apply on a configuration that had unknowns values, you should expect to see multiple executions of ValidateConfig, where the final execution has a fully known config. That's why we typically recommend validation logic not error when encountering unknown values, because it's guaranteed to eventually be known: https://developer.hashicorp.com/terraform/plugin/framework/validation


Are you observing different behavior then what I mentioned above? If so, this might be a bug.

@austinvalle austinvalle added the waiting-response Issues or pull requests waiting for an external response label Mar 7, 2025
@zliang-akamai
Copy link
Contributor Author

Hi @austinvalle, thanks for the information! I think this is a good solution for the problem.

@github-actions github-actions bot removed the waiting-response Issues or pull requests waiting for an external response label Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants