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 checks for unknown values to ValidateConfig() methods #718

Merged
merged 1 commit into from
Jul 13, 2024

Conversation

chrismarget-j
Copy link
Collaborator

Attribute values configured like this can never be unknown:

resource "foo" "x" {
  always_lowercase_string = "hello"
}

...But attribute values based on as-yet-unknown values (perhaps those computed later) are another story:

resource "foo" "x" {
  always_lowercase_string = thing_with_upercase_computed_values.x.an_uppercase_string
}

Resources which implement ResourceWithValidateConfig cannot check the value for case because it won't be known when ValidateConfig() is first run.

Attempts to evaluate these attributes will result in the zero value for those types until a future point when the value is calculated. There's little point in trying to validate them in these cases. Worse, the (temporary) zero value might fail validation.

This PR adds escape hatches for the validation routines where unknown values might have had validation attempted.

Closes #124

@chrismarget-j chrismarget-j merged commit 69dd8aa into main Jul 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task: audit implementations of DataSourceWithValidateConfig and ResourceWithValidateConfig
2 participants