7f860dc83e
When running in v0.12-and-higher mode, this will cause the SDK to report the type of the attribute as "any", effectively skipping type checking on the Core side altogether and checking only in the SDK and provider code. The practical impact of this is to restore the v0.11-style checking behavior of allowing object values to be missing certain attributes as long as they are marked as optional in the schema. The SDK can do this because it uses a unified schema model for both object values and nested blocks, while Terraform Core only supports the idea of "optional" when talking about attributes in nested blocks. This is a continuation of the pile of workarounds that also includes the ConfigMode and AsSingle fields, allowing providers to selectively opt out of new v0.12 behaviors in situations where they conflict with decisions made in the design of the providers in our old world where Terraform Core delegated _all_ validation to providers. This is designed as an opt-in so that we can limit its impact only to specific cases where it's needed and minimize the risk of regressions elsewhere. Providers should use this sparingly only in situations where prevailing usage disagrees with the new expectations of Terraform Core in v0.12. This commit only adds the flag, and does not implement any behavior for it yet. That means this commit can exist in both the v0.11 and v0.12 codebases, allowing for API compatibility. A subsequent commit for v0.12 (not included in v0.11) will then implement this behavior. |
||
---|---|---|
.. | ||
README.md | ||
as_single_fixup.go | ||
as_single_fixup_test.go | ||
backend.go | ||
backend_test.go | ||
core_schema.go | ||
core_schema_test.go | ||
data_source_resource_shim.go | ||
equal.go | ||
field_reader.go | ||
field_reader_config.go | ||
field_reader_config_test.go | ||
field_reader_diff.go | ||
field_reader_diff_test.go | ||
field_reader_map.go | ||
field_reader_map_test.go | ||
field_reader_multi.go | ||
field_reader_multi_test.go | ||
field_reader_test.go | ||
field_writer.go | ||
field_writer_map.go | ||
field_writer_map_test.go | ||
getsource_string.go | ||
provider.go | ||
provider_test.go | ||
provisioner.go | ||
provisioner_test.go | ||
resource.go | ||
resource_data.go | ||
resource_data_get_source.go | ||
resource_data_test.go | ||
resource_diff.go | ||
resource_diff_test.go | ||
resource_importer.go | ||
resource_test.go | ||
resource_timeout.go | ||
resource_timeout_test.go | ||
schema.go | ||
schema_test.go | ||
serialize.go | ||
serialize_test.go | ||
set.go | ||
set_test.go | ||
shims.go | ||
shims_test.go | ||
testing.go | ||
valuetype.go | ||
valuetype_string.go |
README.md
Terraform Helper Lib: schema
The schema
package provides a high-level interface for writing resource
providers for Terraform.
If you're writing a resource provider, we recommend you use this package.
The interface exposed by this package is much friendlier than trying to write to the Terraform API directly. The core Terraform API is low-level and built for maximum flexibility and control, whereas this library is built as a framework around that to more easily write common providers.