├── .changes ├── 1.1.1.md ├── 1.10.0.md ├── 1.11.0.md ├── 1.12.0.md ├── 1.13.0.md ├── 1.14.0.md ├── 1.14.1.md ├── 1.15.0-alpha.1.md ├── 1.15.0-beta.1.md ├── 1.15.0.md ├── 1.2.0.md ├── 1.3.0.md ├── 1.3.1.md ├── 1.3.2.md ├── 1.3.3.md ├── 1.3.4.md ├── 1.3.5.md ├── 1.4.0.md ├── 1.4.1.md ├── 1.4.2.md ├── 1.5.0.md ├── 1.6.0.md ├── 1.6.1.md ├── 1.7.0.md ├── 1.8.0.md ├── 1.9.0.md └── unreleased │ └── .gitkeep ├── .changie.yaml ├── .copywrite.hcl ├── .github ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── SUPPORT.md ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── ci-changie.yml │ ├── ci-github-actions.yml │ ├── ci-go.yml │ ├── ci-goreleaser.yml │ ├── compliance.yml │ ├── issue-comment-triage.yml │ ├── lock.yml │ └── release.yml ├── .gitignore ├── .golangci.yml ├── .goreleaser.yml ├── CHANGELOG.md ├── LICENSE ├── META.d └── _summary.yaml ├── Makefile ├── README.md ├── attr ├── doc.go ├── type.go ├── value.go ├── value_state.go └── xattr │ ├── attribute.go │ ├── doc.go │ └── type.go ├── datasource ├── config_validator.go ├── configure.go ├── data_source.go ├── deferred.go ├── doc.go ├── metadata.go ├── read.go ├── schema.go ├── schema │ ├── attribute.go │ ├── block.go │ ├── bool_attribute.go │ ├── bool_attribute_test.go │ ├── doc.go │ ├── dynamic_attribute.go │ ├── dynamic_attribute_test.go │ ├── float32_attribute.go │ ├── float32_attribute_test.go │ ├── float64_attribute.go │ ├── float64_attribute_test.go │ ├── int32_attribute.go │ ├── int32_attribute_test.go │ ├── int64_attribute.go │ ├── int64_attribute_test.go │ ├── list_attribute.go │ ├── list_attribute_test.go │ ├── list_nested_attribute.go │ ├── list_nested_attribute_test.go │ ├── list_nested_block.go │ ├── list_nested_block_test.go │ ├── map_attribute.go │ ├── map_attribute_test.go │ ├── map_nested_attribute.go │ ├── map_nested_attribute_test.go │ ├── nested_attribute.go │ ├── nested_attribute_object.go │ ├── nested_attribute_object_test.go │ ├── nested_block_object.go │ ├── nested_block_object_test.go │ ├── number_attribute.go │ ├── number_attribute_test.go │ ├── object_attribute.go │ ├── object_attribute_test.go │ ├── schema.go │ ├── schema_test.go │ ├── set_attribute.go │ ├── set_attribute_test.go │ ├── set_nested_attribute.go │ ├── set_nested_attribute_test.go │ ├── set_nested_block.go │ ├── set_nested_block_test.go │ ├── single_nested_attribute.go │ ├── single_nested_attribute_test.go │ ├── single_nested_block.go │ ├── single_nested_block_test.go │ ├── string_attribute.go │ └── string_attribute_test.go └── validate_config.go ├── diag ├── attribute_error_diagnostic.go ├── attribute_warning_diagnostic.go ├── diagnostic.go ├── diagnostics.go ├── diagnostics_test.go ├── doc.go ├── error_diagnostic.go ├── error_diagnostic_test.go ├── severity.go ├── warning_diagnostic.go ├── warning_diagnostic_test.go └── with_path.go ├── docs └── design │ ├── README.md │ ├── attr-value-access.md │ ├── attribute-path.md │ ├── blocks.md │ ├── diagnostics.md │ ├── factories.md │ ├── import.md │ ├── panic-error.md │ ├── plan-modification.md │ ├── resource-registration.md │ ├── runtime-state.md │ ├── schemas.md │ ├── structs-interfaces.md │ ├── upgrade-resource-state.md │ └── validation.md ├── ephemeral ├── close.go ├── config_validator.go ├── configure.go ├── deferred.go ├── doc.go ├── ephemeral_resource.go ├── metadata.go ├── open.go ├── renew.go ├── schema.go ├── schema │ ├── attribute.go │ ├── block.go │ ├── bool_attribute.go │ ├── bool_attribute_test.go │ ├── doc.go │ ├── dynamic_attribute.go │ ├── dynamic_attribute_test.go │ ├── float32_attribute.go │ ├── float32_attribute_test.go │ ├── float64_attribute.go │ ├── float64_attribute_test.go │ ├── int32_attribute.go │ ├── int32_attribute_test.go │ ├── int64_attribute.go │ ├── int64_attribute_test.go │ ├── list_attribute.go │ ├── list_attribute_test.go │ ├── list_nested_attribute.go │ ├── list_nested_attribute_test.go │ ├── list_nested_block.go │ ├── list_nested_block_test.go │ ├── map_attribute.go │ ├── map_attribute_test.go │ ├── map_nested_attribute.go │ ├── map_nested_attribute_test.go │ ├── nested_attribute.go │ ├── nested_attribute_object.go │ ├── nested_attribute_object_test.go │ ├── nested_block_object.go │ ├── nested_block_object_test.go │ ├── number_attribute.go │ ├── number_attribute_test.go │ ├── object_attribute.go │ ├── object_attribute_test.go │ ├── schema.go │ ├── schema_test.go │ ├── set_attribute.go │ ├── set_attribute_test.go │ ├── set_nested_attribute.go │ ├── set_nested_attribute_test.go │ ├── set_nested_block.go │ ├── set_nested_block_test.go │ ├── single_nested_attribute.go │ ├── single_nested_attribute_test.go │ ├── single_nested_block.go │ ├── single_nested_block_test.go │ ├── string_attribute.go │ └── string_attribute_test.go └── validate_config.go ├── function ├── arguments_data.go ├── arguments_data_test.go ├── bool_parameter.go ├── bool_parameter_test.go ├── bool_parameter_validator.go ├── bool_return.go ├── bool_return_test.go ├── definition.go ├── definition_test.go ├── doc.go ├── dynamic_parameter.go ├── dynamic_parameter_test.go ├── dynamic_parameter_validator.go ├── dynamic_return.go ├── dynamic_return_test.go ├── float32_parameter.go ├── float32_parameter_test.go ├── float32_parameter_validator.go ├── float32_return.go ├── float32_return_test.go ├── float64_parameter.go ├── float64_parameter_test.go ├── float64_parameter_validator.go ├── float64_return.go ├── float64_return_test.go ├── func_error.go ├── func_error_test.go ├── function.go ├── int32_parameter.go ├── int32_parameter_test.go ├── int32_parameter_validator.go ├── int32_return.go ├── int32_return_test.go ├── int64_parameter.go ├── int64_parameter_test.go ├── int64_parameter_validator.go ├── int64_return.go ├── int64_return_test.go ├── list_parameter.go ├── list_parameter_test.go ├── list_parameter_validator.go ├── list_return.go ├── list_return_test.go ├── map_parameter.go ├── map_parameter_test.go ├── map_parameter_validator.go ├── map_return.go ├── map_return_test.go ├── metadata.go ├── number_parameter.go ├── number_parameter_test.go ├── number_parameter_validator.go ├── number_return.go ├── number_return_test.go ├── object_parameter.go ├── object_parameter_test.go ├── object_parameter_validator.go ├── object_return.go ├── object_return_test.go ├── parameter.go ├── parameter_validation.go ├── pointer_test.go ├── result_data.go ├── result_data_test.go ├── return.go ├── run.go ├── set_parameter.go ├── set_parameter_test.go ├── set_parameter_validator.go ├── set_return.go ├── set_return_test.go ├── string_parameter.go ├── string_parameter_test.go ├── string_parameter_validator.go ├── string_return.go └── string_return_test.go ├── go.mod ├── go.sum ├── internal ├── fromproto5 │ ├── applyresourcechange.go │ ├── applyresourcechange_test.go │ ├── arguments_data.go │ ├── arguments_data_test.go │ ├── callfunction.go │ ├── callfunction_test.go │ ├── client_capabilities.go │ ├── closeephemeralresource.go │ ├── closeephemeralresource_test.go │ ├── config.go │ ├── config_test.go │ ├── configureprovider.go │ ├── configureprovider_test.go │ ├── doc.go │ ├── dynamic_value.go │ ├── dynamic_value_test.go │ ├── ephemeral_result_data.go │ ├── ephemeral_result_data_test.go │ ├── getfunctions.go │ ├── getfunctions_test.go │ ├── getmetadata.go │ ├── getmetadata_test.go │ ├── getproviderschema.go │ ├── getproviderschema_test.go │ ├── getresourceidentityschemas.go │ ├── getresourceidentityschemas_test.go │ ├── importresourcestate.go │ ├── importresourcestate_test.go │ ├── moveresourcestate.go │ ├── moveresourcestate_test.go │ ├── openephemeralresource.go │ ├── openephemeralresource_test.go │ ├── plan.go │ ├── plan_test.go │ ├── planresourcechange.go │ ├── planresourcechange_test.go │ ├── prepareproviderconfig.go │ ├── prepareproviderconfig_test.go │ ├── providermeta.go │ ├── providermeta_test.go │ ├── rawstate_test.go │ ├── readdatasource.go │ ├── readdatasource_test.go │ ├── readresource.go │ ├── readresource_test.go │ ├── renewephemeralresource.go │ ├── renewephemeralresource_test.go │ ├── resource_identity.go │ ├── resource_identity_test.go │ ├── state.go │ ├── state_test.go │ ├── upgraderesourceidentity.go │ ├── upgraderesourceidentity_test.go │ ├── upgraderesourcestate.go │ ├── upgraderesourcestate_test.go │ ├── validatedatasourceconfig.go │ ├── validatedatasourceconfig_test.go │ ├── validateephemeralresourceconfig.go │ ├── validateephemeralresourceconfig_test.go │ ├── validateresourcetypeconfig.go │ └── validateresourcetypeconfig_test.go ├── fromproto6 │ ├── applyresourcechange.go │ ├── applyresourcechange_test.go │ ├── arguments_data.go │ ├── arguments_data_test.go │ ├── callfunction.go │ ├── callfunction_test.go │ ├── client_capabilities.go │ ├── closeephemeralresource.go │ ├── closeephemeralresource_test.go │ ├── config.go │ ├── config_test.go │ ├── configureprovider.go │ ├── configureprovider_test.go │ ├── doc.go │ ├── dynamic_value.go │ ├── dynamic_value_test.go │ ├── ephemeral_result_data.go │ ├── ephemeral_result_data_test.go │ ├── getfunctions.go │ ├── getfunctions_test.go │ ├── getmetadata.go │ ├── getmetadata_test.go │ ├── getproviderschema.go │ ├── getproviderschema_test.go │ ├── getresourceidentityschemas.go │ ├── getresourceidentityschemas_test.go │ ├── importresourcestate.go │ ├── importresourcestate_test.go │ ├── moveresourcestate.go │ ├── moveresourcestate_test.go │ ├── openephemeralresource.go │ ├── openephemeralresource_test.go │ ├── plan.go │ ├── plan_test.go │ ├── planresourcechange.go │ ├── planresourcechange_test.go │ ├── providermeta.go │ ├── providermeta_test.go │ ├── rawstate_test.go │ ├── readdatasource.go │ ├── readdatasource_test.go │ ├── readresource.go │ ├── readresource_test.go │ ├── renewephemeralresource.go │ ├── renewephemeralresource_test.go │ ├── resource_identity.go │ ├── resource_identity_test.go │ ├── state.go │ ├── state_test.go │ ├── upgraderesourceidentity.go │ ├── upgraderesourceidentity_test.go │ ├── upgraderesourcestate.go │ ├── upgraderesourcestate_test.go │ ├── validatedatasourceconfig.go │ ├── validatedatasourceconfig_test.go │ ├── validateephemeralresourceconfig.go │ ├── validateephemeralresourceconfig_test.go │ ├── validateproviderconfig.go │ ├── validateproviderconfig_test.go │ ├── validateresourceconfig.go │ └── validateresourceconfig_test.go ├── fromtftypes │ ├── attribute_path.go │ ├── attribute_path_step.go │ ├── attribute_path_step_test.go │ ├── attribute_path_test.go │ ├── doc.go │ ├── value.go │ └── value_test.go ├── fwfunction │ ├── diagnostics.go │ ├── doc.go │ ├── parameter_validate_implementation.go │ └── return_validate_implementation.go ├── fwschema │ ├── attribute.go │ ├── attribute_default.go │ ├── attribute_name_validation.go │ ├── attribute_name_validation_test.go │ ├── attribute_nesting_mode.go │ ├── attribute_validate_implementation.go │ ├── block.go │ ├── block_nested_mode.go │ ├── block_validate_implementation.go │ ├── diagnostics.go │ ├── doc.go │ ├── errors.go │ ├── fwxschema │ │ ├── attribute_plan_modification.go │ │ ├── attribute_validation.go │ │ ├── block_plan_modification.go │ │ ├── block_validation.go │ │ ├── doc.go │ │ ├── nested_attribute_object_plan_modification.go │ │ ├── nested_attribute_object_validation.go │ │ ├── nested_block_object_plan_modification.go │ │ └── nested_block_object_validators.go │ ├── nested_attribute.go │ ├── nested_attribute_object.go │ ├── nested_block_object.go │ ├── schema.go │ ├── schema_test.go │ ├── underlying_attributes.go │ ├── validate_implementation.go │ └── write_only_nested_attribute_validation.go ├── fwschemadata │ ├── data.go │ ├── data_default.go │ ├── data_default_test.go │ ├── data_description.go │ ├── data_get.go │ ├── data_get_at_path.go │ ├── data_get_at_path_test.go │ ├── data_get_test.go │ ├── data_nullify_collection_blocks.go │ ├── data_nullify_collection_blocks_test.go │ ├── data_path_exists.go │ ├── data_path_exists_test.go │ ├── data_path_matches.go │ ├── data_path_matches_test.go │ ├── data_reify_null_collection_blocks.go │ ├── data_reify_null_collection_blocks_test.go │ ├── data_set.go │ ├── data_set_at_path.go │ ├── data_set_at_path_test.go │ ├── data_set_test.go │ ├── data_terraform_value.go │ ├── data_valid_path_expression.go │ ├── data_valid_path_expression_test.go │ ├── data_value.go │ ├── data_value_test.go │ ├── doc.go │ ├── pointer_test.go │ ├── tftypes_value.go │ ├── tftypes_value_test.go │ ├── value_semantic_equality.go │ ├── value_semantic_equality_bool.go │ ├── value_semantic_equality_bool_test.go │ ├── value_semantic_equality_dynamic.go │ ├── value_semantic_equality_dynamic_test.go │ ├── value_semantic_equality_float32.go │ ├── value_semantic_equality_float32_test.go │ ├── value_semantic_equality_float64.go │ ├── value_semantic_equality_float64_test.go │ ├── value_semantic_equality_int32.go │ ├── value_semantic_equality_int32_test.go │ ├── value_semantic_equality_int64.go │ ├── value_semantic_equality_int64_test.go │ ├── value_semantic_equality_list.go │ ├── value_semantic_equality_list_test.go │ ├── value_semantic_equality_map.go │ ├── value_semantic_equality_map_test.go │ ├── value_semantic_equality_number.go │ ├── value_semantic_equality_number_test.go │ ├── value_semantic_equality_object.go │ ├── value_semantic_equality_object_test.go │ ├── value_semantic_equality_set.go │ ├── value_semantic_equality_set_test.go │ ├── value_semantic_equality_string.go │ ├── value_semantic_equality_string_test.go │ └── value_semantic_equality_test.go ├── fwserver │ ├── attr_type.go │ ├── attr_value.go │ ├── attribute_plan_modification.go │ ├── attribute_plan_modification_test.go │ ├── attribute_validation.go │ ├── attribute_validation_test.go │ ├── block_plan_modification.go │ ├── block_plan_modification_test.go │ ├── block_validation.go │ ├── block_validation_test.go │ ├── diagnostics.go │ ├── doc.go │ ├── proto6_test.go │ ├── schema_plan_modification.go │ ├── schema_plan_modification_test.go │ ├── schema_semantic_equality.go │ ├── schema_semantic_equality_test.go │ ├── schema_validation.go │ ├── schema_validation_test.go │ ├── server.go │ ├── server_applyresourcechange.go │ ├── server_applyresourcechange_test.go │ ├── server_callfunction.go │ ├── server_callfunction_test.go │ ├── server_capabilities.go │ ├── server_closeephemeralresource.go │ ├── server_closeephemeralresource_test.go │ ├── server_configureprovider.go │ ├── server_configureprovider_test.go │ ├── server_createresource.go │ ├── server_createresource_test.go │ ├── server_deleteresource.go │ ├── server_deleteresource_test.go │ ├── server_ephemeralresources.go │ ├── server_functions.go │ ├── server_getfunctions.go │ ├── server_getfunctions_test.go │ ├── server_getmetadata.go │ ├── server_getmetadata_test.go │ ├── server_getproviderschema.go │ ├── server_getproviderschema_test.go │ ├── server_getresourceidentityschemas.go │ ├── server_getresourceidentityschemas_test.go │ ├── server_importresourcestate.go │ ├── server_importresourcestate_test.go │ ├── server_listresources.go │ ├── server_moveresourcestate.go │ ├── server_moveresourcestate_test.go │ ├── server_openephemeralresource.go │ ├── server_openephemeralresource_test.go │ ├── server_planresourcechange.go │ ├── server_planresourcechange_test.go │ ├── server_readdatasource.go │ ├── server_readdatasource_test.go │ ├── server_readresource.go │ ├── server_readresource_test.go │ ├── server_renewephemeralresource.go │ ├── server_renewephemeralresource_test.go │ ├── server_updateresource.go │ ├── server_updateresource_test.go │ ├── server_upgraderesourceidentity.go │ ├── server_upgraderesourceidentity_test.go │ ├── server_upgraderesourcestate.go │ ├── server_upgraderesourcestate_test.go │ ├── server_validatedatasourceconfig.go │ ├── server_validatedatasourceconfig_test.go │ ├── server_validateephemeralresourceconfig.go │ ├── server_validateephemeralresourceconfig_test.go │ ├── server_validateproviderconfig.go │ ├── server_validateproviderconfig_test.go │ ├── server_validateresourceconfig.go │ ├── server_validateresourceconfig_test.go │ ├── write_only_nullification.go │ └── write_only_nullification_test.go ├── fwtype │ ├── doc.go │ ├── missing_underlying_type_validation.go │ ├── missing_underlying_type_validation_test.go │ ├── static_collection_validation.go │ └── static_collection_validation_test.go ├── logging │ ├── context.go │ ├── context_test.go │ ├── doc.go │ ├── environment_variables.go │ ├── framework.go │ ├── framework_test.go │ └── keys.go ├── privatestate │ ├── data.go │ ├── data_test.go │ └── doc.go ├── proto5server │ ├── doc.go │ ├── serve.go │ ├── serve_test.go │ ├── server_applyresourcechange.go │ ├── server_applyresourcechange_test.go │ ├── server_callfunction.go │ ├── server_callfunction_test.go │ ├── server_closeephemeralresource.go │ ├── server_closeephemeralresource_test.go │ ├── server_configureprovider.go │ ├── server_configureprovider_test.go │ ├── server_getfunctions.go │ ├── server_getfunctions_test.go │ ├── server_getmetadata.go │ ├── server_getmetadata_test.go │ ├── server_getproviderschema.go │ ├── server_getproviderschema_test.go │ ├── server_getresourceidentityschemas.go │ ├── server_getresourceidentityschemas_test.go │ ├── server_importresourcestate.go │ ├── server_importresourcestate_test.go │ ├── server_moveresourcestate.go │ ├── server_moveresourcestate_test.go │ ├── server_openephemeralresource.go │ ├── server_openephemeralresource_test.go │ ├── server_planresourcechange.go │ ├── server_planresourcechange_test.go │ ├── server_prepareproviderconfig.go │ ├── server_prepareproviderconfig_test.go │ ├── server_readdatasource.go │ ├── server_readdatasource_test.go │ ├── server_readresource.go │ ├── server_readresource_test.go │ ├── server_renewephemeralresource.go │ ├── server_renewephemeralresource_test.go │ ├── server_upgraderesourceidentity.go │ ├── server_upgraderesourceidentity_test.go │ ├── server_upgraderesourcestate.go │ ├── server_upgraderesourcestate_test.go │ ├── server_validatedatasourceconfig.go │ ├── server_validatedatasourceconfig_test.go │ ├── server_validateephemeralresourceconfig.go │ ├── server_validateephemeralresourceconfig_test.go │ ├── server_validateresourcetypeconfig.go │ └── server_validateresourcetypeconfig_test.go ├── proto6server │ ├── doc.go │ ├── serve.go │ ├── serve_test.go │ ├── server_applyresourcechange.go │ ├── server_applyresourcechange_test.go │ ├── server_callfunction.go │ ├── server_callfunction_test.go │ ├── server_closeephemeralresource.go │ ├── server_closeephemeralresource_test.go │ ├── server_configureprovider.go │ ├── server_configureprovider_test.go │ ├── server_getfunctions.go │ ├── server_getfunctions_test.go │ ├── server_getmetadata.go │ ├── server_getmetadata_test.go │ ├── server_getproviderschema.go │ ├── server_getproviderschema_test.go │ ├── server_getresourceidentityschemas.go │ ├── server_getresourceidentityschemas_test.go │ ├── server_importresourcestate.go │ ├── server_importresourcestate_test.go │ ├── server_moveresourcestate.go │ ├── server_moveresourcestate_test.go │ ├── server_openephemeralresource.go │ ├── server_openephemeralresource_test.go │ ├── server_planresourcechange.go │ ├── server_planresourcechange_test.go │ ├── server_readdatasource.go │ ├── server_readdatasource_test.go │ ├── server_readresource.go │ ├── server_readresource_test.go │ ├── server_renewephemeralresource.go │ ├── server_renewephemeralresource_test.go │ ├── server_upgraderesourceidentity.go │ ├── server_upgraderesourceidentity_test.go │ ├── server_upgraderesourcestate.go │ ├── server_upgraderesourcestate_test.go │ ├── server_validatedataresourceconfig.go │ ├── server_validatedataresourceconfig_test.go │ ├── server_validateephemeralresourceconfig.go │ ├── server_validateephemeralresourceconfig_test.go │ ├── server_validateproviderconfig.go │ ├── server_validateproviderconfig_test.go │ ├── server_validateresourceconfig.go │ └── server_validateresourceconfig_test.go ├── reflect │ ├── build_value_test.go │ ├── diags.go │ ├── doc.go │ ├── generic_attr_value.go │ ├── helpers.go │ ├── helpers_test.go │ ├── interfaces.go │ ├── interfaces_test.go │ ├── into.go │ ├── into_test.go │ ├── map.go │ ├── map_test.go │ ├── number.go │ ├── number_test.go │ ├── options.go │ ├── outof.go │ ├── outof_test.go │ ├── pointer.go │ ├── pointer_test.go │ ├── pointer_zero_test.go │ ├── primitive.go │ ├── primitive_test.go │ ├── slice.go │ ├── slice_test.go │ ├── struct.go │ └── struct_test.go ├── testing │ ├── doc.go │ ├── planmodifiers │ │ ├── doc.go │ │ └── planmodifiers.go │ ├── testdefaults │ │ ├── bool.go │ │ ├── doc.go │ │ ├── dynamic.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── list.go │ │ ├── map.go │ │ ├── number.go │ │ ├── object.go │ │ ├── set.go │ │ └── string.go │ ├── testplanmodifier │ │ ├── bool.go │ │ ├── doc.go │ │ ├── dynamic.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── list.go │ │ ├── map.go │ │ ├── number.go │ │ ├── object.go │ │ ├── set.go │ │ └── string.go │ ├── testprovider │ │ ├── datasource.go │ │ ├── datasourceconfigvalidator.go │ │ ├── datasourcewithconfigure.go │ │ ├── datasourcewithconfigvalidators.go │ │ ├── datasourcewithvalidateconfig.go │ │ ├── doc.go │ │ ├── ephemeralresource.go │ │ ├── ephemeralresourceconfigvalidator.go │ │ ├── ephemeralresourcewithclose.go │ │ ├── ephemeralresourcewithconfigure.go │ │ ├── ephemeralresourcewithconfigureandclose.go │ │ ├── ephemeralresourcewithconfigureandrenew.go │ │ ├── ephemeralresourcewithconfigvalidators.go │ │ ├── ephemeralresourcewithrenew.go │ │ ├── ephemeralresourcewithvalidateconfig.go │ │ ├── function.go │ │ ├── list_resource.go │ │ ├── provider.go │ │ ├── providerconfigvalidator.go │ │ ├── providerwithconfigvalidators.go │ │ ├── providerwithfunctions.go │ │ ├── providerwithmetaschema.go │ │ ├── providerwithvalidateconfig.go │ │ ├── resource.go │ │ ├── resourceconfigvalidator.go │ │ ├── resourcewithconfigure.go │ │ ├── resourcewithconfigureandimportstate.go │ │ ├── resourcewithconfigureandmodifyplan.go │ │ ├── resourcewithconfigureandupgradeidentity.go │ │ ├── resourcewithconfigureandupgradestate.go │ │ ├── resourcewithconfigvalidators.go │ │ ├── resourcewithidentity.go │ │ ├── resourcewithidentityandimportstate.go │ │ ├── resourcewithidentityandmodifyplan.go │ │ ├── resourcewithidentityandmovestate.go │ │ ├── resourcewithimportstate.go │ │ ├── resourcewithmodifyplan.go │ │ ├── resourcewithmovestate.go │ │ ├── resourcewithupgradeidentity.go │ │ ├── resourcewithupgradestate.go │ │ └── resourcewithvalidateconfig.go │ ├── testschema │ │ ├── attribute.go │ │ ├── attributewithbooldefault.go │ │ ├── attributewithboolplanmodifiers.go │ │ ├── attributewithboolvalidators.go │ │ ├── attributewithdynamicdefault.go │ │ ├── attributewithdynamicplanmodifiers.go │ │ ├── attributewithdynamicvalidators.go │ │ ├── attributewithfloat32default.go │ │ ├── attributewithfloat32planmodifiers.go │ │ ├── attributewithfloat32validators.go │ │ ├── attributewithfloat64default.go │ │ ├── attributewithfloat64planmodifiers.go │ │ ├── attributewithfloat64validators.go │ │ ├── attributewithint32default.go │ │ ├── attributewithint32planmodifiers.go │ │ ├── attributewithint32validators.go │ │ ├── attributewithint64default.go │ │ ├── attributewithint64planmodifiers.go │ │ ├── attributewithint64validators.go │ │ ├── attributewithlistdefault.go │ │ ├── attributewithlistplanmodifiers.go │ │ ├── attributewithlistvalidators.go │ │ ├── attributewithmapdefault.go │ │ ├── attributewithmapplanmodifiers.go │ │ ├── attributewithmapvalidators.go │ │ ├── attributewithnumberdefault.go │ │ ├── attributewithnumberplanmodifiers.go │ │ ├── attributewithnumbervalidators.go │ │ ├── attributewithobjectdefault.go │ │ ├── attributewithobjectplanmodifiers.go │ │ ├── attributewithobjectvalidators.go │ │ ├── attributewithsetdefault.go │ │ ├── attributewithsetplanmodifiers.go │ │ ├── attributewithsetvalidators.go │ │ ├── attributewithstringdefault.go │ │ ├── attributewithstringplanmodifiers.go │ │ ├── attributewithstringvalidators.go │ │ ├── block.go │ │ ├── blockwithlistplanmodifiers.go │ │ ├── blockwithlistvalidators.go │ │ ├── blockwithobjectplanmodifiers.go │ │ ├── blockwithobjectvalidators.go │ │ ├── blockwithsetplanmodifiers.go │ │ ├── blockwithsetvalidators.go │ │ ├── doc.go │ │ ├── nested_attribute.go │ │ ├── nested_attribute_object.go │ │ ├── nested_attribute_object_custom_type.go │ │ ├── nested_attribute_object_list_custom_type.go │ │ ├── nested_attribute_object_map_custom_type.go │ │ ├── nested_attribute_object_set_custom_type.go │ │ ├── nested_attribute_object_with_planmodifiers.go │ │ ├── nested_attribute_object_with_validators.go │ │ ├── nested_attribute_with_list_default.go │ │ ├── nested_attribute_with_list_plan_modifiers.go │ │ ├── nested_attribute_with_map_default.go │ │ ├── nested_attribute_with_map_plan_modifiers.go │ │ ├── nested_attribute_with_object_default.go │ │ ├── nested_attribute_with_object_plan_modifiers.go │ │ ├── nested_attribute_with_set_default.go │ │ ├── nested_attribute_with_set_plan_modifiers.go │ │ ├── nested_block_object.go │ │ ├── nested_block_object_with_plan_modifiers.go │ │ ├── nested_block_object_with_validators.go │ │ └── schema.go │ ├── testtypes │ │ ├── bool.go │ │ ├── boolwithsemanticequals.go │ │ ├── boolwithvalidate.go │ │ ├── boolwithvalidateattribute.go │ │ ├── boolwithvalidateparameter.go │ │ ├── diags.go │ │ ├── doc.go │ │ ├── dynamic.go │ │ ├── dynamicwithsemanticequals.go │ │ ├── float32.go │ │ ├── float32withsemanticequals.go │ │ ├── float64.go │ │ ├── float64withsemanticequals.go │ │ ├── int32.go │ │ ├── int32withsemanticequals.go │ │ ├── int64.go │ │ ├── int64withsemanticequals.go │ │ ├── invalid.go │ │ ├── list.go │ │ ├── listnestedattributescustom.go │ │ ├── listwithsemanticequals.go │ │ ├── listwithvalidate.go │ │ ├── listwithvalidateattribute.go │ │ ├── map.go │ │ ├── mapnestedattributescustom.go │ │ ├── mapwithsemanticequals.go │ │ ├── mapwithvalidate.go │ │ ├── mapwithvalidateattribute.go │ │ ├── number.go │ │ ├── numberwithsemanticequals.go │ │ ├── numberwithvalidate.go │ │ ├── numberwithvalidateattribute.go │ │ ├── object.go │ │ ├── objectwithsemanticequals.go │ │ ├── objectwithvalidate.go │ │ ├── objectwithvalidateattribute.go │ │ ├── set.go │ │ ├── setnestedattributescustom.go │ │ ├── setwithsemanticequals.go │ │ ├── setwithvalidate.go │ │ ├── setwithvalidateattribute.go │ │ ├── singlenestedattributescustom.go │ │ ├── string.go │ │ ├── stringwithsemanticequals.go │ │ ├── stringwithvalidate.go │ │ ├── stringwithvalidateattribute.go │ │ └── stringwithvalidateparameter.go │ └── testvalidator │ │ ├── bool.go │ │ ├── doc.go │ │ ├── dynamic.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── list.go │ │ ├── map.go │ │ ├── number.go │ │ ├── object.go │ │ ├── set.go │ │ └── string.go ├── toproto5 │ ├── applyresourcechange.go │ ├── applyresourcechange_test.go │ ├── block.go │ ├── block_test.go │ ├── callfunction.go │ ├── callfunction_test.go │ ├── closeephemeralresource.go │ ├── closeephemeralresource_test.go │ ├── config.go │ ├── config_test.go │ ├── configureprovider.go │ ├── configureprovider_test.go │ ├── datasourcemetadata.go │ ├── datasourcemetadata_test.go │ ├── deferred.go │ ├── diagnostics.go │ ├── diagnostics_test.go │ ├── doc.go │ ├── dynamic_value.go │ ├── dynamic_value_test.go │ ├── ephemeral_result_data.go │ ├── ephemeral_result_data_test.go │ ├── ephemeralresourcemetadata.go │ ├── ephemeralresourcemetadata_test.go │ ├── function.go │ ├── function_errors.go │ ├── function_test.go │ ├── getfunctions.go │ ├── getfunctions_test.go │ ├── getmetadata.go │ ├── getmetadata_test.go │ ├── getproviderschema.go │ ├── getproviderschema_test.go │ ├── getresourceidentityschemas.go │ ├── getresourceidentityschemas_test.go │ ├── identity_schema.go │ ├── identity_schema_attribute.go │ ├── identity_schema_attribute_test.go │ ├── identity_schema_test.go │ ├── importedresource.go │ ├── importedresource_test.go │ ├── importresourcestate.go │ ├── moveresourcestate.go │ ├── moveresourcestate_test.go │ ├── openephemeralresource.go │ ├── openephemeralresource_test.go │ ├── planresourcechange.go │ ├── planresourcechange_test.go │ ├── pointer_test.go │ ├── prepareproviderconfig.go │ ├── prepareproviderconfig_test.go │ ├── readdatasource.go │ ├── readdatasource_test.go │ ├── readresource.go │ ├── readresource_test.go │ ├── renewephemeralresource.go │ ├── renewephemeralresource_test.go │ ├── resource_identity.go │ ├── resource_identity_test.go │ ├── resourcemetadata.go │ ├── resourcemetadata_test.go │ ├── schema.go │ ├── schema_attribute.go │ ├── schema_attribute_test.go │ ├── schema_test.go │ ├── server_capabilities.go │ ├── server_capabilities_test.go │ ├── state.go │ ├── state_test.go │ ├── upgraderesourceidentity.go │ ├── upgraderesourceidentity_test.go │ ├── upgraderesourcestate.go │ ├── upgraderesourcestate_test.go │ ├── validatedatasourceconfig.go │ ├── validatedatasourceconfig_test.go │ ├── validateephemeralresourceconfig.go │ ├── validateephemeralresourceconfig_test.go │ ├── validateresourcetypeconfig.go │ └── validateresourcetypeconfig_test.go ├── toproto6 │ ├── applyresourcechange.go │ ├── applyresourcechange_test.go │ ├── block.go │ ├── block_test.go │ ├── callfunction.go │ ├── callfunction_test.go │ ├── closeephemeralresource.go │ ├── closeephemeralresource_test.go │ ├── config.go │ ├── config_test.go │ ├── configureprovider.go │ ├── configureprovider_test.go │ ├── datasourcemetadata.go │ ├── datasourcemetadata_test.go │ ├── deferred.go │ ├── diagnostics.go │ ├── diagnostics_test.go │ ├── doc.go │ ├── dynamic_value.go │ ├── dynamic_value_test.go │ ├── ephemeral_result_data.go │ ├── ephemeral_result_data_test.go │ ├── ephemeralresourcemetadata.go │ ├── ephemeralresourcemetadata_test.go │ ├── function.go │ ├── function_errors.go │ ├── function_test.go │ ├── getfunctions.go │ ├── getfunctions_test.go │ ├── getmetadata.go │ ├── getmetadata_test.go │ ├── getproviderschema.go │ ├── getproviderschema_test.go │ ├── getresourceidentityschemas.go │ ├── getresourceidentityschemas_test.go │ ├── identity_schema.go │ ├── identity_schema_attribute.go │ ├── identity_schema_attribute_test.go │ ├── identity_schema_test.go │ ├── importedresource.go │ ├── importedresource_test.go │ ├── importresourcestate.go │ ├── moveresourcestate.go │ ├── moveresourcestate_test.go │ ├── openephemeralresource.go │ ├── openephemeralresource_test.go │ ├── planresourcechange.go │ ├── planresourcechange_test.go │ ├── pointer_test.go │ ├── readdatasource.go │ ├── readdatasource_test.go │ ├── readresource.go │ ├── readresource_test.go │ ├── renewephemeralresource.go │ ├── renewephemeralresource_test.go │ ├── resource_identity.go │ ├── resource_identity_test.go │ ├── resourcemetadata.go │ ├── resourcemetadata_test.go │ ├── schema.go │ ├── schema_attribute.go │ ├── schema_attribute_test.go │ ├── schema_test.go │ ├── server_capabilities.go │ ├── server_capabilities_test.go │ ├── state.go │ ├── state_test.go │ ├── upgraderesourceidentity.go │ ├── upgraderesourceidentity_test.go │ ├── upgraderesourcestate.go │ ├── upgraderesourcestate_test.go │ ├── validatedatasourceconfig.go │ ├── validatedatasourceconfig_test.go │ ├── validateephemeralresourceconfig.go │ ├── validateephemeralresourceconfig_test.go │ ├── validateproviderconfig.go │ ├── validateproviderconfig_test.go │ ├── validateresourceconfig.go │ └── validateresourceconfig_test.go └── totftypes │ ├── attribute_path.go │ ├── attribute_path_step.go │ ├── attribute_path_step_test.go │ ├── attribute_path_test.go │ ├── attribute_paths.go │ ├── attribute_paths_test.go │ └── doc.go ├── list ├── config_validator.go ├── list_resource.go ├── list_resource_test.go ├── no_op_list_resource_test.go ├── no_op_resource_test.go ├── schema.go └── schema │ ├── attribute.go │ ├── block.go │ ├── doc.go │ ├── schema.go │ ├── schema_test.go │ ├── string_attribute.go │ └── string_attribute_test.go ├── path ├── doc.go ├── expression.go ├── expression_step.go ├── expression_step_attribute_name_exact.go ├── expression_step_attribute_name_exact_test.go ├── expression_step_element_key_int_any.go ├── expression_step_element_key_int_any_test.go ├── expression_step_element_key_int_exact.go ├── expression_step_element_key_int_exact_test.go ├── expression_step_element_key_string_any.go ├── expression_step_element_key_string_any_test.go ├── expression_step_element_key_string_exact.go ├── expression_step_element_key_string_exact_test.go ├── expression_step_element_key_value_any.go ├── expression_step_element_key_value_any_test.go ├── expression_step_element_key_value_exact.go ├── expression_step_element_key_value_exact_test.go ├── expression_step_parent.go ├── expression_step_parent_test.go ├── expression_steps.go ├── expression_steps_test.go ├── expression_test.go ├── expressions.go ├── expressions_test.go ├── path.go ├── path_step.go ├── path_step_attribute_name.go ├── path_step_attribute_name_test.go ├── path_step_element_key_int.go ├── path_step_element_key_int_test.go ├── path_step_element_key_string.go ├── path_step_element_key_string_test.go ├── path_step_element_key_value.go ├── path_step_element_key_value_test.go ├── path_steps.go ├── path_steps_test.go ├── path_test.go ├── paths.go └── paths_test.go ├── provider ├── config_validator.go ├── configure.go ├── deferred.go ├── doc.go ├── metadata.go ├── metaschema.go ├── metaschema │ ├── attribute.go │ ├── bool_attribute.go │ ├── bool_attribute_test.go │ ├── doc.go │ ├── float64_attribute.go │ ├── float64_attribute_test.go │ ├── int64_attribute.go │ ├── int64_attribute_test.go │ ├── list_attribute.go │ ├── list_attribute_test.go │ ├── list_nested_attribute.go │ ├── list_nested_attribute_test.go │ ├── map_attribute.go │ ├── map_attribute_test.go │ ├── map_nested_attribute.go │ ├── map_nested_attribute_test.go │ ├── nested_attribute.go │ ├── nested_attribute_object.go │ ├── nested_attribute_object_test.go │ ├── number_attribute.go │ ├── number_attribute_test.go │ ├── object_attribute.go │ ├── object_attribute_test.go │ ├── schema.go │ ├── schema_test.go │ ├── set_attribute.go │ ├── set_attribute_test.go │ ├── set_nested_attribute.go │ ├── set_nested_attribute_test.go │ ├── single_nested_attribute.go │ ├── single_nested_attribute_test.go │ ├── string_attribute.go │ └── string_attribute_test.go ├── provider.go ├── schema.go ├── schema │ ├── attribute.go │ ├── block.go │ ├── bool_attribute.go │ ├── bool_attribute_test.go │ ├── doc.go │ ├── dynamic_attribute.go │ ├── dynamic_attribute_test.go │ ├── float32_attribute.go │ ├── float32_attribute_test.go │ ├── float64_attribute.go │ ├── float64_attribute_test.go │ ├── int32_attribute.go │ ├── int32_attribute_test.go │ ├── int64_attribute.go │ ├── int64_attribute_test.go │ ├── list_attribute.go │ ├── list_attribute_test.go │ ├── list_nested_attribute.go │ ├── list_nested_attribute_test.go │ ├── list_nested_block.go │ ├── list_nested_block_test.go │ ├── map_attribute.go │ ├── map_attribute_test.go │ ├── map_nested_attribute.go │ ├── map_nested_attribute_test.go │ ├── nested_attribute.go │ ├── nested_attribute_object.go │ ├── nested_attribute_object_test.go │ ├── nested_block_object.go │ ├── nested_block_object_test.go │ ├── number_attribute.go │ ├── number_attribute_test.go │ ├── object_attribute.go │ ├── object_attribute_test.go │ ├── schema.go │ ├── schema_test.go │ ├── set_attribute.go │ ├── set_attribute_test.go │ ├── set_nested_attribute.go │ ├── set_nested_attribute_test.go │ ├── set_nested_block.go │ ├── set_nested_block_test.go │ ├── single_nested_attribute.go │ ├── single_nested_attribute_test.go │ ├── single_nested_block.go │ ├── single_nested_block_test.go │ ├── string_attribute.go │ └── string_attribute_test.go └── validate_config.go ├── providerserver ├── doc.go ├── providerserver.go ├── providerserver_test.go ├── serve_opts.go └── serve_opts_test.go ├── resource ├── config_validator.go ├── configure.go ├── create.go ├── deferred.go ├── delete.go ├── doc.go ├── identity_schema.go ├── identity_upgrader.go ├── identityschema │ ├── attribute.go │ ├── bool_attribute.go │ ├── bool_attribute_test.go │ ├── doc.go │ ├── float32_attribute.go │ ├── float32_attribute_test.go │ ├── float64_attribute.go │ ├── float64_attribute_test.go │ ├── int32_attribute.go │ ├── int32_attribute_test.go │ ├── int64_attribute.go │ ├── int64_attribute_test.go │ ├── list_attribute.go │ ├── list_attribute_test.go │ ├── number_attribute.go │ ├── number_attribute_test.go │ ├── schema.go │ ├── schema_test.go │ ├── string_attribute.go │ └── string_attribute_test.go ├── import_state.go ├── metadata.go ├── modify_plan.go ├── move_state.go ├── read.go ├── resource.go ├── schema.go ├── schema │ ├── attribute.go │ ├── block.go │ ├── bool_attribute.go │ ├── bool_attribute_test.go │ ├── booldefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── boolplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── defaults │ │ ├── bool.go │ │ ├── describer.go │ │ ├── doc.go │ │ ├── dynamic.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── list.go │ │ ├── map.go │ │ ├── number.go │ │ ├── object.go │ │ ├── set.go │ │ └── string.go │ ├── doc.go │ ├── dynamic_attribute.go │ ├── dynamic_attribute_test.go │ ├── dynamicdefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── dynamicplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── float32_attribute.go │ ├── float32_attribute_test.go │ ├── float32default │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── float32planmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── float64_attribute.go │ ├── float64_attribute_test.go │ ├── float64default │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── float64planmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── int32_attribute.go │ ├── int32_attribute_test.go │ ├── int32default │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── int32planmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── int64_attribute.go │ ├── int64_attribute_test.go │ ├── int64default │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── int64planmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── list_attribute.go │ ├── list_attribute_test.go │ ├── list_nested_attribute.go │ ├── list_nested_attribute_test.go │ ├── list_nested_block.go │ ├── list_nested_block_test.go │ ├── listdefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── listplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── map_attribute.go │ ├── map_attribute_test.go │ ├── map_nested_attribute.go │ ├── map_nested_attribute_test.go │ ├── mapdefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── mapplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── nested_attribute.go │ ├── nested_attribute_object.go │ ├── nested_attribute_object_test.go │ ├── nested_block_object.go │ ├── nested_block_object_test.go │ ├── number_attribute.go │ ├── number_attribute_test.go │ ├── numberdefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── numberplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── object_attribute.go │ ├── object_attribute_test.go │ ├── objectdefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── objectplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── planmodifier │ │ ├── bool.go │ │ ├── describer.go │ │ ├── doc.go │ │ ├── dynamic.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── list.go │ │ ├── map.go │ │ ├── number.go │ │ ├── object.go │ │ ├── set.go │ │ └── string.go │ ├── schema.go │ ├── schema_test.go │ ├── set_attribute.go │ ├── set_attribute_test.go │ ├── set_nested_attribute.go │ ├── set_nested_attribute_test.go │ ├── set_nested_block.go │ ├── set_nested_block_test.go │ ├── setdefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── setplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ ├── single_nested_attribute.go │ ├── single_nested_attribute_test.go │ ├── single_nested_block.go │ ├── single_nested_block_test.go │ ├── string_attribute.go │ ├── string_attribute_test.go │ ├── stringdefault │ │ ├── doc.go │ │ ├── static_value.go │ │ └── static_value_test.go │ ├── stringplanmodifier │ │ ├── doc.go │ │ ├── requires_replace.go │ │ ├── requires_replace_if.go │ │ ├── requires_replace_if_configured.go │ │ ├── requires_replace_if_configured_test.go │ │ ├── requires_replace_if_func.go │ │ ├── requires_replace_if_test.go │ │ ├── requires_replace_test.go │ │ ├── use_state_for_unknown.go │ │ └── use_state_for_unknown_test.go │ └── write_only_nested_attribute_validation_test.go ├── state_mover.go ├── state_upgrader.go ├── update.go ├── upgrade_identity.go ├── upgrade_state.go └── validate_config.go ├── schema ├── doc.go └── validator │ ├── bool.go │ ├── client_capabilities.go │ ├── describer.go │ ├── doc.go │ ├── dynamic.go │ ├── float32.go │ ├── float64.go │ ├── int32.go │ ├── int64.go │ ├── list.go │ ├── map.go │ ├── number.go │ ├── object.go │ ├── set.go │ └── string.go ├── tfsdk ├── config.go ├── config_test.go ├── convert.go ├── convert_test.go ├── doc.go ├── ephemeral_result_data.go ├── ephemeral_result_data_test.go ├── plan.go ├── plan_test.go ├── pointer_test.go ├── resource.go ├── resource_identity.go ├── resource_identity_test.go ├── state.go ├── state_test.go ├── value_as.go ├── value_as_test.go ├── value_from.go └── value_from_test.go ├── tools ├── copywrite.go ├── go.mod └── go.sum ├── types ├── basetypes │ ├── bool_type.go │ ├── bool_type_test.go │ ├── bool_value.go │ ├── bool_value_test.go │ ├── doc.go │ ├── dynamic_type.go │ ├── dynamic_type_test.go │ ├── dynamic_value.go │ ├── dynamic_value_test.go │ ├── float32_type.go │ ├── float32_type_test.go │ ├── float32_value.go │ ├── float32_value_test.go │ ├── float64_type.go │ ├── float64_type_test.go │ ├── float64_value.go │ ├── float64_value_test.go │ ├── int32_type.go │ ├── int32_type_test.go │ ├── int32_value.go │ ├── int32_value_test.go │ ├── int64_type.go │ ├── int64_type_test.go │ ├── int64_value.go │ ├── int64_value_test.go │ ├── list_type.go │ ├── list_type_test.go │ ├── list_value.go │ ├── list_value_test.go │ ├── map_type.go │ ├── map_type_test.go │ ├── map_value.go │ ├── map_value_test.go │ ├── missing_type.go │ ├── missing_value.go │ ├── number_type.go │ ├── number_type_test.go │ ├── number_value.go │ ├── number_value_test.go │ ├── object_type.go │ ├── object_type_test.go │ ├── object_value.go │ ├── object_value_test.go │ ├── pointer_test.go │ ├── set_type.go │ ├── set_type_test.go │ ├── set_value.go │ ├── set_value_test.go │ ├── string_type.go │ ├── string_type_test.go │ ├── string_value.go │ ├── string_value_test.go │ ├── tuple_type.go │ ├── tuple_type_test.go │ ├── tuple_value.go │ └── tuple_value_test.go ├── bool_type.go ├── bool_value.go ├── doc.go ├── dynamic_type.go ├── dynamic_value.go ├── float32_type.go ├── float32_value.go ├── float64_type.go ├── float64_value.go ├── int32_type.go ├── int32_value.go ├── int64_type.go ├── int64_value.go ├── list_type.go ├── list_value.go ├── map_type.go ├── map_value.go ├── number_type.go ├── number_value.go ├── object_type.go ├── object_value.go ├── set_type.go ├── set_value.go ├── string_type.go ├── string_value.go ├── tuple_type.go └── tuple_value.go └── website ├── Makefile ├── README.md ├── data └── plugin-framework-nav-data.json ├── docs └── plugin │ └── framework │ ├── acctests.mdx │ ├── data-sources │ ├── configure.mdx │ ├── index.mdx │ ├── timeouts.mdx │ └── validate-configuration.mdx │ ├── debugging.mdx │ ├── deprecations.mdx │ ├── diagnostics.mdx │ ├── ephemeral-resources │ ├── close.mdx │ ├── configure.mdx │ ├── index.mdx │ ├── open.mdx │ ├── renew.mdx │ └── validate-configuration.mdx │ ├── functions │ ├── concepts.mdx │ ├── documentation.mdx │ ├── errors.mdx │ ├── implementation.mdx │ ├── index.mdx │ ├── parameters │ │ ├── bool.mdx │ │ ├── dynamic.mdx │ │ ├── float32.mdx │ │ ├── float64.mdx │ │ ├── index.mdx │ │ ├── int32.mdx │ │ ├── int64.mdx │ │ ├── list.mdx │ │ ├── map.mdx │ │ ├── number.mdx │ │ ├── object.mdx │ │ ├── set.mdx │ │ └── string.mdx │ ├── returns │ │ ├── bool.mdx │ │ ├── dynamic.mdx │ │ ├── float32.mdx │ │ ├── float64.mdx │ │ ├── index.mdx │ │ ├── int32.mdx │ │ ├── int64.mdx │ │ ├── list.mdx │ │ ├── map.mdx │ │ ├── number.mdx │ │ ├── object.mdx │ │ ├── set.mdx │ │ └── string.mdx │ └── testing.mdx │ ├── getting-started │ └── code-walkthrough.mdx │ ├── handling-data │ ├── accessing-values.mdx │ ├── attributes │ │ ├── bool.mdx │ │ ├── dynamic.mdx │ │ ├── float32.mdx │ │ ├── float64.mdx │ │ ├── index.mdx │ │ ├── int32.mdx │ │ ├── int64.mdx │ │ ├── list-nested.mdx │ │ ├── list.mdx │ │ ├── map-nested.mdx │ │ ├── map.mdx │ │ ├── number.mdx │ │ ├── object.mdx │ │ ├── set-nested.mdx │ │ ├── set.mdx │ │ ├── single-nested.mdx │ │ └── string.mdx │ ├── blocks │ │ ├── index.mdx │ │ ├── list-nested.mdx │ │ ├── set-nested.mdx │ │ └── single-nested.mdx │ ├── dynamic-data.mdx │ ├── path-expressions.mdx │ ├── paths.mdx │ ├── schemas.mdx │ ├── terraform-concepts.mdx │ ├── types │ │ ├── bool.mdx │ │ ├── custom.mdx │ │ ├── dynamic.mdx │ │ ├── float32.mdx │ │ ├── float64.mdx │ │ ├── index.mdx │ │ ├── int32.mdx │ │ ├── int64.mdx │ │ ├── list.mdx │ │ ├── map.mdx │ │ ├── number.mdx │ │ ├── object.mdx │ │ ├── set.mdx │ │ ├── string.mdx │ │ └── tuple.mdx │ └── writing-state.mdx │ ├── index.mdx │ ├── internals │ ├── index.mdx │ └── rpcs.mdx │ ├── migrating │ ├── attributes-blocks │ │ ├── attribute-schema.mdx │ │ ├── blocks-computed.mdx │ │ ├── blocks.mdx │ │ ├── default-values.mdx │ │ ├── fields.mdx │ │ ├── force-new.mdx │ │ ├── types.mdx │ │ ├── validators-custom.mdx │ │ └── validators-predefined.mdx │ ├── benefits.mdx │ ├── data-sources │ │ ├── index.mdx │ │ └── timeouts.mdx │ ├── index.mdx │ ├── mux.mdx │ ├── providers │ │ └── index.mdx │ ├── resources │ │ ├── crud.mdx │ │ ├── import.mdx │ │ ├── index.mdx │ │ ├── plan-modification.mdx │ │ ├── state-upgrade.mdx │ │ └── timeouts.mdx │ ├── schema │ │ └── index.mdx │ └── testing.mdx │ ├── provider-servers.mdx │ ├── providers │ ├── index.mdx │ └── validate-configuration.mdx │ ├── resources │ ├── configure.mdx │ ├── create.mdx │ ├── default.mdx │ ├── delete.mdx │ ├── import.mdx │ ├── index.mdx │ ├── plan-modification.mdx │ ├── private-state.mdx │ ├── read.mdx │ ├── state-move.mdx │ ├── state-upgrade.mdx │ ├── timeouts.mdx │ ├── update.mdx │ ├── validate-configuration.mdx │ └── write-only-arguments.mdx │ └── validation.mdx ├── img ├── .gitkeep ├── README.md ├── apply-resource-change-detail.png ├── apply-resource-change-overview.png ├── configure-provider-detail.png ├── configure-provider-overview.png ├── get-provider-schema-detail.png ├── get-provider-schema-overview.png ├── plan-resource-change-detail.png ├── plan-resource-change-overview.png ├── read-data-source-detail.png ├── read-overview.png ├── read-resource-detail.png ├── validate-config-overview.png ├── validate-data-resource-config-detail.png ├── validate-provider-config-detail.png └── validate-resource-config-detail.png ├── package-lock.json ├── package.json └── scripts ├── should-build.sh ├── website-build.sh └── website-start.sh /.changes/1.12.0.md: -------------------------------------------------------------------------------- 1 | ## 1.12.0 (September 18, 2024) 2 | 3 | NOTES: 4 | 5 | * all: This Go module has been updated to Go 1.22 per the [Go support policy](https://go.dev/doc/devel/release#policy). It is recommended to review the [Go 1.22 release notes](https://go.dev/doc/go1.22) before upgrading. Any consumers building on earlier Go versions may experience errors ([#1033](https://github.com/hashicorp/terraform-plugin-framework/issues/1033)) 6 | 7 | BUG FIXES: 8 | 9 | * providerserver: Fixed bug that prevented `moved` operation support between resource types for framework-only providers. ([#1039](https://github.com/hashicorp/terraform-plugin-framework/issues/1039)) 10 | 11 | -------------------------------------------------------------------------------- /.changes/1.14.1.md: -------------------------------------------------------------------------------- 1 | ## 1.14.1 (February 20, 2025) 2 | 3 | BUG FIXES: 4 | 5 | * internal/fwserver: fixed bug where write-only attributes set in configuration would cause perpetual diffs for computed attributes. ([#1097](https://github.com/hashicorp/terraform-plugin-framework/issues/1097)) 6 | 7 | -------------------------------------------------------------------------------- /.changes/1.15.0-alpha.1.md: -------------------------------------------------------------------------------- 1 | ## 1.15.0-alpha.1 (March 18, 2025) 2 | 3 | NOTES: 4 | 5 | * all: This Go module has been updated to Go 1.23 per the [Go support policy](https://go.dev/doc/devel/release#policy). It is recommended to review the [Go 1.23 release notes](https://go.dev/doc/go1.23) before upgrading. Any consumers building on earlier Go versions may experience errors. ([#1114](https://github.com/hashicorp/terraform-plugin-framework/issues/1114)) 6 | * This alpha pre-release contains an initial implementation for managed resource identity, which can used with Terraform v1.12.0-alpha20250312, to store and read identity data during plan and apply workflows. A managed resource identity can be used by implementing the optional `resource.ResourceWithIdentity` interface and defining an identity schema. Once the identity schema is defined, you can read and store identity data in the state file via the new `Identity` fields in the response objects on the resource CRUD methods. ([#1112](https://github.com/hashicorp/terraform-plugin-framework/issues/1112)) 7 | 8 | -------------------------------------------------------------------------------- /.changes/1.15.0-beta.1.md: -------------------------------------------------------------------------------- 1 | ## 1.15.0-beta.1 (April 15, 2025) 2 | 3 | NOTES: 4 | 5 | * This beta pre-release continues the implementation of managed resource identity, which should now be used with Terraform v1.12.0-beta1. Managed resources now can support import by identity during plan and apply workflows. Managed resources that already support import via the `resource.ResourceWithImportState` interface will automatically pass-through identity data to the `Read` method. The `RequiredForImport` and `OptionalForImport` fields on the identity schema can be used to control the validation that Terraform core will apply to the import config block. ([#1126](https://github.com/hashicorp/terraform-plugin-framework/issues/1126)) 6 | 7 | -------------------------------------------------------------------------------- /.changes/1.3.2.md: -------------------------------------------------------------------------------- 1 | ## 1.3.2 (June 28, 2023) 2 | 3 | BUG FIXES: 4 | 5 | * resource/schema: Ensured `Default` implementations received request `Path` and have response `Diagnostics` handled ([#778](https://github.com/hashicorp/terraform-plugin-framework/issues/778)) 6 | * resource/schema: Prevented panics with `Default` implementations on list, map, and set where no response `Diagnostics` or `PlanValue` was returned ([#778](https://github.com/hashicorp/terraform-plugin-framework/issues/778)) 7 | * providerserver: Ensured Terraform CLI interrupts (e.g. Ctrl-c) properly cancel the `context.Context` of inflight requests ([#782](https://github.com/hashicorp/terraform-plugin-framework/issues/782)) 8 | * providerserver: Prevented caching of unused data and managed resource schemas ([#784](https://github.com/hashicorp/terraform-plugin-framework/issues/784)) 9 | 10 | -------------------------------------------------------------------------------- /.changes/1.3.3.md: -------------------------------------------------------------------------------- 1 | ## 1.3.3 (July 20, 2023) 2 | 3 | BUG FIXES: 4 | 5 | * types/basetypes: Minor reduction of memory allocations for `ObjectValue` type `ToTerraformValue()` method, which decreases provider operation durations at scale ([#775](https://github.com/hashicorp/terraform-plugin-framework/issues/775)) 6 | * resource: Prevented panic during planning caused by `SetNestedAttribute` with nested attribute `Default` and multiple configured elements ([#783](https://github.com/hashicorp/terraform-plugin-framework/issues/783)) 7 | * tfsdk: Prevented `Value Conversion Error` diagnostics when using `Set()` method with base types instead of custom types ([#806](https://github.com/hashicorp/terraform-plugin-framework/issues/806)) 8 | * providerserver: Significantly reduced memory usage for framework data handling operations, especially during the `PlanResourceChange` RPC ([#792](https://github.com/hashicorp/terraform-plugin-framework/issues/792)) 9 | 10 | -------------------------------------------------------------------------------- /.changes/1.3.4.md: -------------------------------------------------------------------------------- 1 | ## 1.3.4 (August 03, 2023) 2 | 3 | BUG FIXES: 4 | 5 | * types/basetypes: Prevented Float64Value Terraform data consistency errors for numbers with high precision floating point rounding errors ([#817](https://github.com/hashicorp/terraform-plugin-framework/issues/817)) 6 | 7 | -------------------------------------------------------------------------------- /.changes/1.3.5.md: -------------------------------------------------------------------------------- 1 | ## 1.3.5 (August 17, 2023) 2 | 3 | NOTES: 4 | 5 | * internal: Changed provider defined method execution logs from `DEBUG` log level to `TRACE` ([#818](https://github.com/hashicorp/terraform-plugin-framework/issues/818)) 6 | 7 | BUG FIXES: 8 | 9 | * internal/fwserver: Prevented `Invalid Element Type` diagnostics for nested attributes and blocks implementing `CustomType` field ([#823](https://github.com/hashicorp/terraform-plugin-framework/issues/823)) 10 | 11 | -------------------------------------------------------------------------------- /.changes/1.4.0.md: -------------------------------------------------------------------------------- 1 | ## 1.4.0 (September 06, 2023) 2 | 3 | NOTES: 4 | 5 | * all: This Go module has been updated to Go 1.20 per the [Go support policy](https://go.dev/doc/devel/release#policy). It is recommended to review the [Go 1.20 release notes](https://go.dev/doc/go1.20) before upgrading. Any consumers building on earlier Go versions may experience errors. ([#835](https://github.com/hashicorp/terraform-plugin-framework/issues/835)) 6 | 7 | FEATURES: 8 | 9 | * providerserver: Upgrade to protocol versions 5.4 and 6.4, which can significantly reduce memory usage with Terraform 1.6 and later when a configuration includes multiple instances of the same provider ([#828](https://github.com/hashicorp/terraform-plugin-framework/issues/828)) 10 | 11 | -------------------------------------------------------------------------------- /.changes/1.4.1.md: -------------------------------------------------------------------------------- 1 | ## 1.4.1 (October 09, 2023) 2 | 3 | BUG FIXES: 4 | 5 | * providerserver: Prevented `Data Source Type Not Found` and `Resource Type Not Found` errors with Terraform 1.6 and later ([#853](https://github.com/hashicorp/terraform-plugin-framework/issues/853)) 6 | 7 | -------------------------------------------------------------------------------- /.changes/1.4.2.md: -------------------------------------------------------------------------------- 1 | ## 1.4.2 (October 24, 2023) 2 | 3 | BUG FIXES: 4 | 5 | * resource: Add `Private` field to `DeleteResource` type, which was missing to allow provider logic to update private state on errors ([#863](https://github.com/hashicorp/terraform-plugin-framework/issues/863)) 6 | * resource: Prevented private state data loss if resource destruction returned an error ([#863](https://github.com/hashicorp/terraform-plugin-framework/issues/863)) 7 | 8 | -------------------------------------------------------------------------------- /.changes/1.6.1.md: -------------------------------------------------------------------------------- 1 | ## 1.6.1 (March 05, 2024) 2 | 3 | NOTES: 4 | 5 | * all: The `v1.6.0` release updated this Go module to Go 1.21 per the [Go support policy](https://go.dev/doc/devel/release#policy). It is recommended to review the [Go 1.21 release notes](https://go.dev/doc/go1.21) before upgrading. Any consumers building on earlier Go versions may experience errors ([#937](https://github.com/hashicorp/terraform-plugin-framework/issues/937)) 6 | 7 | BUG FIXES: 8 | 9 | * resource/schema: Ensured invalid attribute default value errors are raised ([#930](https://github.com/hashicorp/terraform-plugin-framework/issues/930)) 10 | * function: Added implementation validation to `function.Definition` to ensure all parameter names (including the variadic parameter) are unique. ([#926](https://github.com/hashicorp/terraform-plugin-framework/issues/926)) 11 | * function: Updated the default parameter name to include the position of the parameter (i.e. `param1`, `param2`, etc.). Variadic parameters will default to `varparam`. ([#926](https://github.com/hashicorp/terraform-plugin-framework/issues/926)) 12 | 13 | -------------------------------------------------------------------------------- /.changes/unreleased/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/.changes/unreleased/.gitkeep -------------------------------------------------------------------------------- /.changie.yaml: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT - This GitHub Workflow is managed by automation 2 | # https://github.com/hashicorp/terraform-devex-repos 3 | changesDir: .changes 4 | unreleasedDir: unreleased 5 | changelogPath: CHANGELOG.md 6 | versionExt: md 7 | versionFormat: '## {{.Version}} ({{.Time.Format "January 02, 2006"}})' 8 | kindFormat: '{{.Kind}}:' 9 | changeFormat: '* {{.Body}} ([#{{.Custom.Issue}}](https://github.com/hashicorp/terraform-plugin-framework/issues/{{.Custom.Issue}}))' 10 | custom: 11 | - key: Issue 12 | label: Issue/PR Number 13 | type: int 14 | minInt: 1 15 | kinds: 16 | - label: BREAKING CHANGES 17 | - label: NOTES 18 | - label: FEATURES 19 | - label: ENHANCEMENTS 20 | - label: BUG FIXES 21 | newlines: 22 | afterKind: 1 23 | beforeKind: 1 24 | endOfVersion: 2 25 | -------------------------------------------------------------------------------- /.copywrite.hcl: -------------------------------------------------------------------------------- 1 | schema_version = 1 2 | 3 | project { 4 | license = "MPL-2.0" 5 | copyright_year = 2021 6 | 7 | header_ignore = [ 8 | # internal catalog metadata (prose) 9 | "META.d/**/*.yaml", 10 | 11 | # changie tooling configuration and CHANGELOG entries (prose) 12 | ".changes/unreleased/**", 13 | ".changie.yaml", 14 | 15 | # GitHub issue template configuration 16 | ".github/ISSUE_TEMPLATE/*.yml", 17 | 18 | # GitHub Actions workflow-specific configurations 19 | ".github/labeler-*.yml", 20 | 21 | # golangci-lint tooling configuration 22 | ".golangci.yml", 23 | 24 | # GoReleaser tooling configuration 25 | ".goreleaser.yml", 26 | 27 | # Release Engineering tooling configuration 28 | ".release/*.hcl", 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @hashicorp/terraform-core-plugins 2 | 3 | # engineering and web presence get notified of, and can approve changes to web tooling, but not content. 4 | 5 | /website/ @hashicorp/web-presence @hashicorp/terraform-core-plugins 6 | /website/data/ 7 | /website/public/ 8 | /website/content/ 9 | 10 | # education and engineering get notified of, and can approve changes to web content. 11 | 12 | /website/data/ @hashicorp/team-docs-packer-and-terraform @hashicorp/terraform-core-plugins 13 | /website/public/ @hashicorp/team-docs-packer-and-terraform @hashicorp/terraform-core-plugins 14 | /website/content/ @hashicorp/team-docs-packer-and-terraform @hashicorp/terraform-core-plugins 15 | /website/docs/ @hashicorp/team-docs-packer-and-terraform @hashicorp/terraform-core-plugins 16 | /website/img/ @hashicorp/team-docs-packer-and-terraform @hashicorp/terraform-core-plugins 17 | /website/README.md @hashicorp/team-docs-packer-and-terraform @hashicorp/terraform-core-plugins 18 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code. 4 | 5 | Please read the full text at https://www.hashicorp.com/community-guidelines 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Provider-related Feedback and Questions 4 | url: https://github.com/terraform-providers 5 | about: Each provider (e.g. AWS, Azure, GCP, Oracle, K8S, etc.) has its own repository, any provider related issues or questions should be directed to appropriate provider repository. 6 | - name: Terraform Language or Workflow Feedback and Questions 7 | url: https://github.com/hashicorp/terraform/issues/new/choose 8 | about: Terraform Core has its own repository, any language (HCL) or workflow related issues or questions should be directed there. 9 | - name: ❓ Plugin SDK Questions 10 | url: https://discuss.hashicorp.com/c/terraform-providers/tf-plugin-sdk 11 | about: Please ask and answer SDK related questions through the Plugin SDK Community Forum. 12 | -------------------------------------------------------------------------------- /.github/SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | Terraform is a mature project with a growing community. There are active, dedicated people willing to help you through various mediums. 4 | 5 | Take a look at those mediums listed at https://www.terraform.io/community.html 6 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | - package-ecosystem: "gomod" 8 | directory: "/tools" 9 | schedule: 10 | interval: "daily" 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "daily" 15 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Related Issue 2 | 3 | Fixes # 4 | 5 | ## Description 6 | 7 | In plain English, describe your approach to addressing the issue linked above. For example, if you made a particular design decision, let us know why you chose this path instead of another solution. 8 | 9 | 10 | ## Rollback Plan 11 | 12 | - [ ] If a change needs to be reverted, we will roll out an update to the code within 7 days. 13 | 14 | ## Changes to Security Controls 15 | 16 | Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain. 17 | -------------------------------------------------------------------------------- /.github/workflows/ci-changie.yml: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT - This GitHub Workflow is managed by automation 2 | # https://github.com/hashicorp/terraform-devex-repos 3 | 4 | # Continuous integration handling for changie 5 | name: ci-changie 6 | 7 | on: 8 | pull_request: 9 | paths: 10 | - .changes/unreleased/*.yaml 11 | - .changie.yaml 12 | - .github/workflows/ci-changie.yml 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | check: 19 | runs-on: ubuntu-latest 20 | steps: 21 | # Ensure terraform-devex-repos is updated on version changes. 22 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 23 | # Ensure terraform-devex-repos is updated on version changes. 24 | - uses: miniscruff/changie-action@6dcc2533cac0495148ed4046c438487e4dceaa23 # v2.0.0 25 | with: 26 | version: latest 27 | args: batch patch --dry-run 28 | -------------------------------------------------------------------------------- /.github/workflows/ci-github-actions.yml: -------------------------------------------------------------------------------- 1 | # Continuous integration handling for GitHub Actions workflows 2 | name: ci-github-actions 3 | 4 | on: 5 | pull_request: 6 | paths: 7 | - .github/workflows/*.yml 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | actionlint: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 17 | - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 18 | with: 19 | go-version-file: 'go.mod' 20 | - run: go install github.com/rhysd/actionlint/cmd/actionlint@latest 21 | - run: actionlint 22 | -------------------------------------------------------------------------------- /.github/workflows/ci-goreleaser.yml: -------------------------------------------------------------------------------- 1 | # Continuous integration handling for GoReleaser 2 | name: ci-goreleaser 3 | 4 | on: 5 | pull_request: 6 | paths: 7 | - .github/workflows/ci-goreleaser.yml 8 | - .goreleaser.yml 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | check: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 18 | - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 19 | with: 20 | go-version-file: 'go.mod' 21 | - uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 22 | with: 23 | args: check 24 | -------------------------------------------------------------------------------- /.github/workflows/compliance.yml: -------------------------------------------------------------------------------- 1 | name: compliance 2 | 3 | on: 4 | pull_request: 5 | 6 | permissions: 7 | contents: read 8 | 9 | jobs: 10 | # Reference: ENGSRV-059 11 | copywrite: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 15 | - uses: hashicorp/setup-copywrite@32638da2d4e81d56a0764aa1547882fc4d209636 # v1.1.3 16 | - run: copywrite headers --plan 17 | - run: copywrite license --plan -------------------------------------------------------------------------------- /.github/workflows/issue-comment-triage.yml: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT - This GitHub Workflow is managed by automation 2 | # https://github.com/hashicorp/terraform-devex-repos 3 | name: Issue Comment Triage 4 | 5 | on: 6 | issue_comment: 7 | types: [created] 8 | 9 | jobs: 10 | issue_comment_triage: 11 | runs-on: ubuntu-latest 12 | env: 13 | # issue_comment events are triggered by comments on issues and pull requests. Checking the 14 | # value of github.event.issue.pull_request tells us whether the issue is an issue or is 15 | # actually a pull request, allowing us to dynamically set the gh subcommand: 16 | # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only 17 | COMMAND: ${{ github.event.issue.pull_request && 'pr' || 'issue' }} 18 | GH_TOKEN: ${{ github.token }} 19 | steps: 20 | - name: 'Remove waiting-response on comment' 21 | run: gh ${{ env.COMMAND }} edit ${{ github.event.issue.html_url }} --remove-label waiting-response 22 | -------------------------------------------------------------------------------- /.github/workflows/lock.yml: -------------------------------------------------------------------------------- 1 | # DO NOT EDIT - This GitHub Workflow is managed by automation 2 | # https://github.com/hashicorp/terraform-devex-repos 3 | name: 'Lock Threads' 4 | 5 | on: 6 | schedule: 7 | - cron: '25 17 * * *' 8 | 9 | jobs: 10 | lock: 11 | runs-on: ubuntu-latest 12 | steps: 13 | # NOTE: When TSCCR updates the GitHub action version, update the template workflow file to avoid drift: 14 | # https://github.com/hashicorp/terraform-devex-repos/blob/main/modules/repo/workflows/lock.tftpl 15 | - uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1 16 | with: 17 | github-token: ${{ github.token }} 18 | issue-inactive-days: '30' 19 | issue-lock-reason: resolved 20 | pr-inactive-days: '30' 21 | pr-lock-reason: resolved 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Website generation artifacts 2 | node_modules 3 | website-preview 4 | 5 | # Jetbrains IDEs 6 | .idea/ 7 | *.iws 8 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | project_name: terraform-plugin-framework 3 | builds: 4 | - skip: true 5 | milestones: 6 | - close: true 7 | release: 8 | prerelease: auto 9 | ids: 10 | - 'none' 11 | -------------------------------------------------------------------------------- /META.d/_summary.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | schema: 1.1 3 | 4 | partition: tf-ecosystem 5 | 6 | summary: 7 | owner: team-tf-core-plugins 8 | description: | 9 | A next-generation framework for building Terraform providers. 10 | visibility: public 11 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Generate copywrite headers 2 | generate: 3 | cd tools; go generate ./... 4 | 5 | # Run this if working on the website locally to run in watch mode. 6 | .PHONY: website 7 | website: 8 | $(MAKE) -C website website 9 | 10 | # Use this if you have run `website/build-local` to use the locally built image. 11 | .PHONY: website/local 12 | website/local: 13 | $(MAKE) -C website website/local 14 | 15 | # Run this to generate a new local Docker image. 16 | # Use a local Docker image if you want to verify that images embedded in pages render correctly. 17 | .PHONY: website/build-local 18 | website/build-local: 19 | $(MAKE) -C website website/build-local -------------------------------------------------------------------------------- /attr/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package attr contains type and value interfaces for core framework and 5 | // provider-defined data types. The underlying xattr package contains 6 | // additional interfaces for advanced type functionality. 7 | package attr 8 | -------------------------------------------------------------------------------- /attr/value_state.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package attr 5 | 6 | import "fmt" 7 | 8 | const ( 9 | // ValueStateNull represents a value which is null. 10 | // 11 | // This value is 0 so it is the zero-value for types implementations. 12 | ValueStateNull ValueState = 0 13 | 14 | // ValueStateUnknown represents a value which is unknown. 15 | ValueStateUnknown ValueState = 1 16 | 17 | // ValueStateKnown represents a value which is known (not null or unknown). 18 | ValueStateKnown ValueState = 2 19 | ) 20 | 21 | type ValueState uint8 22 | 23 | func (s ValueState) String() string { 24 | switch s { 25 | case ValueStateKnown: 26 | return "known" 27 | case ValueStateNull: 28 | return "null" 29 | case ValueStateUnknown: 30 | return "unknown" 31 | default: 32 | panic(fmt.Sprintf("unhandled ValueState in String: %d", s)) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /attr/xattr/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package xattr contains additional interfaces for attr types. This package 5 | // is separate from the core attr package to prevent import cycles. 6 | package xattr 7 | -------------------------------------------------------------------------------- /datasource/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package datasource contains all interfaces, request types, and response 5 | // types for a data source implementation. 6 | // 7 | // In Terraform, a data source is a concept which enables provider developers 8 | // to offer practitioners a read-only source of information, which is saved 9 | // into the Terraform state and can be referenced by other parts of a 10 | // configuration. Data sources are defined by a data source type/name, such as 11 | // "examplecloud_thing", a schema representing the structure and data types of 12 | // configuration and state, and read logic. 13 | // 14 | // The main starting point for implementations in this package is the 15 | // DataSource type which represents an instance of a data source type that has 16 | // its own configuration, read logic, and state. The DataSource implementations 17 | // are referenced by a [provider.Provider] type DataSources method, which 18 | // enables the data source for practitioner and testing usage. 19 | package datasource 20 | -------------------------------------------------------------------------------- /datasource/metadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package datasource 5 | 6 | // MetadataRequest represents a request for the DataSource to return metadata, 7 | // such as its type name. An instance of this request struct is supplied as an 8 | // argument to the DataSource type Metadata method. 9 | type MetadataRequest struct { 10 | // ProviderTypeName is the string returned from 11 | // [provider.MetadataResponse.TypeName], if the Provider type implements 12 | // the Metadata method. This string should prefix the DataSource type name 13 | // with an underscore in the response. 14 | ProviderTypeName string 15 | } 16 | 17 | // MetadataResponse represents a response to a MetadataRequest. An 18 | // instance of this response struct is supplied as an argument to the 19 | // DataSource type Metadata method. 20 | type MetadataResponse struct { 21 | // TypeName should be the full data source type, including the provider 22 | // type prefix and an underscore. For example, examplecloud_thing. 23 | TypeName string 24 | } 25 | -------------------------------------------------------------------------------- /datasource/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package datasource 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/datasource/schema" 8 | "github.com/hashicorp/terraform-plugin-framework/diag" 9 | ) 10 | 11 | // SchemaRequest represents a request for the DataSource to return its schema. 12 | // An instance of this request struct is supplied as an argument to the 13 | // DataSource type Schema method. 14 | type SchemaRequest struct{} 15 | 16 | // SchemaResponse represents a response to a SchemaRequest. An instance of this 17 | // response struct is supplied as an argument to the DataSource type Schema 18 | // method. 19 | type SchemaResponse struct { 20 | // Schema is the schema of the data source. 21 | Schema schema.Schema 22 | 23 | // Diagnostics report errors or warnings related to validating the data 24 | // source configuration. An empty slice indicates success, with no warnings 25 | // or errors generated. 26 | Diagnostics diag.Diagnostics 27 | } 28 | -------------------------------------------------------------------------------- /datasource/schema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package schema contains all available schema functionality for data sources. 5 | // Data source schemas define the structure and value types for configuration 6 | // and state data. Schemas are implemented via the datasource.DataSource type 7 | // Schema method. 8 | package schema 9 | -------------------------------------------------------------------------------- /datasource/schema/nested_attribute.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package schema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Nested attributes are only compatible with protocol version 6. 11 | type NestedAttribute interface { 12 | Attribute 13 | fwschema.NestedAttribute 14 | } 15 | -------------------------------------------------------------------------------- /diag/attribute_error_diagnostic.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package diag 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/path" 8 | ) 9 | 10 | // NewAttributeErrorDiagnostic returns a new error severity diagnostic with the given summary, detail, and path. 11 | func NewAttributeErrorDiagnostic(path path.Path, summary string, detail string) DiagnosticWithPath { 12 | return withPath{ 13 | Diagnostic: NewErrorDiagnostic(summary, detail), 14 | path: path, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /diag/attribute_warning_diagnostic.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package diag 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/path" 8 | ) 9 | 10 | // NewAttributeWarningDiagnostic returns a new warning severity diagnostic with the given summary, detail, and path. 11 | func NewAttributeWarningDiagnostic(path path.Path, summary string, detail string) DiagnosticWithPath { 12 | return withPath{ 13 | Diagnostic: NewWarningDiagnostic(summary, detail), 14 | path: path, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /diag/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package diag implements diagnostic functionality, which is a practitioner 5 | // feedback mechanism for providers. It is designed for display in Terraform 6 | // user interfaces, rather than logging based feedback, which is generally 7 | // saved to a file for later inspection and troubleshooting. 8 | // 9 | // Practitioner feedback for provider defined functions is provided by the 10 | // [function.FuncError] type, rather than the [diag.Diagnostic] type. 11 | package diag 12 | -------------------------------------------------------------------------------- /ephemeral/metadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package ephemeral 5 | 6 | // MetadataRequest represents a request for the EphemeralResource to return metadata, 7 | // such as its type name. An instance of this request struct is supplied as 8 | // an argument to the EphemeralResource type Metadata method. 9 | type MetadataRequest struct { 10 | // ProviderTypeName is the string returned from 11 | // [provider.MetadataResponse.TypeName], if the Provider type implements 12 | // the Metadata method. This string should prefix the EphemeralResource type name 13 | // with an underscore in the response. 14 | ProviderTypeName string 15 | } 16 | 17 | // MetadataResponse represents a response to a MetadataRequest. An 18 | // instance of this response struct is supplied as an argument to the 19 | // EphemeralResource type Metadata method. 20 | type MetadataResponse struct { 21 | // TypeName should be the full ephemeral resource type, including the provider 22 | // type prefix and an underscore. For example, examplecloud_thing. 23 | TypeName string 24 | } 25 | -------------------------------------------------------------------------------- /ephemeral/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package ephemeral 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/ephemeral/schema" 9 | ) 10 | 11 | // SchemaRequest represents a request for the EphemeralResource to return its schema. 12 | // An instance of this request struct is supplied as an argument to the 13 | // EphemeralResource type Schema method. 14 | type SchemaRequest struct{} 15 | 16 | // SchemaResponse represents a response to a SchemaRequest. An instance of this 17 | // response struct is supplied as an argument to the EphemeralResource type Schema 18 | // method. 19 | type SchemaResponse struct { 20 | // Schema is the schema of the ephemeral resource. 21 | Schema schema.Schema 22 | 23 | // Diagnostics report errors or warnings related to retrieving the ephemeral 24 | // resource schema. An empty slice indicates success, with no warnings 25 | // or errors generated. 26 | Diagnostics diag.Diagnostics 27 | } 28 | -------------------------------------------------------------------------------- /ephemeral/schema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package schema contains all available schema functionality for ephemeral resources. 5 | // Ephemeral resource schemas define the structure and value types for configuration 6 | // and result data. Schemas are implemented via the ephemeral.EphemeralResource type 7 | // Schema method. 8 | package schema 9 | -------------------------------------------------------------------------------- /ephemeral/schema/nested_attribute.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package schema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Nested attributes are only compatible with protocol version 6. 11 | type NestedAttribute interface { 12 | Attribute 13 | fwschema.NestedAttribute 14 | } 15 | -------------------------------------------------------------------------------- /function/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package function contains all interfaces, request types, and response 5 | // types for a Terraform Provider function implementation. 6 | // 7 | // In Terraform, a function is a concept which enables provider developers 8 | // to offer practitioners a pure function call in their configuration. Functions 9 | // are defined by a function name, such as "parse_xyz", a definition 10 | // representing the ordered list of parameters with associated data types and 11 | // a result data type, and the function logic. 12 | // 13 | // The main starting point for implementations in this package is the 14 | // [Function] type which represents an instance of a function that has its own 15 | // argument data when called. The [Function] implementations are referenced by a 16 | // [provider.Provider] type Functions method, which enables the function for 17 | // practitioner and testing usage. 18 | // 19 | // Practitioner feedback is provided by the [FuncError] type, rather than 20 | // the [diag.Diagnostic] type. 21 | package function 22 | -------------------------------------------------------------------------------- /function/function.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package function 5 | 6 | import ( 7 | "context" 8 | ) 9 | 10 | // Function represents an instance of a function. This is the core interface 11 | // that all functions must implement. 12 | // 13 | // Provider-defined functions are supported in Terraform version 1.8 and later. 14 | type Function interface { 15 | // Metadata should return the name of the function, such as parse_xyz. 16 | Metadata(context.Context, MetadataRequest, *MetadataResponse) 17 | 18 | // Definition should return the definition for the function. 19 | Definition(context.Context, DefinitionRequest, *DefinitionResponse) 20 | 21 | // Run should return the result of the function logic. It is called when 22 | // Terraform reaches a function call in the configuration. Argument data 23 | // values should be read from the [RunRequest] and the result value set in 24 | // the [RunResponse]. 25 | Run(context.Context, RunRequest, *RunResponse) 26 | } 27 | -------------------------------------------------------------------------------- /function/metadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package function 5 | 6 | // MetadataRequest represents a request for the Function to return metadata, 7 | // such as its name. An instance of this request struct is supplied as an 8 | // argument to the Function type Metadata method. 9 | type MetadataRequest struct{} 10 | 11 | // MetadataResponse represents a response to a MetadataRequest. An 12 | // instance of this response struct is supplied as an argument to the 13 | // Function type Metadata method. 14 | type MetadataResponse struct { 15 | // Name should be the function name, such as parse_xyz. Unlike data sources 16 | // and managed resources, the provider name and an underscore should not be 17 | // included as the Terraform configuration syntax for provider function 18 | // calls already include the provider name. 19 | Name string 20 | } 21 | -------------------------------------------------------------------------------- /function/pointer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package function_test 5 | 6 | func pointer[T any](value T) *T { 7 | return &value 8 | } 9 | -------------------------------------------------------------------------------- /function/return.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package function 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/attr" 10 | ) 11 | 12 | // Return is the interface for defining function return data. 13 | type Return interface { 14 | // GetType should return the data type for the return, which determines 15 | // what data type Terraform requires for configurations receiving the 16 | // response of a function call and the return data type required from the 17 | // Function type Run method. 18 | GetType() attr.Type 19 | 20 | // NewResultData should return a new ResultData with an unknown value (or 21 | // best approximation of an invalid value) of the corresponding data type. 22 | // The Function type Run method is expected to overwrite the value before 23 | // returning. 24 | NewResultData(context.Context) (ResultData, *FuncError) 25 | } 26 | -------------------------------------------------------------------------------- /internal/fromproto5/callfunction.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/function" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 13 | ) 14 | 15 | // CallFunctionRequest returns the *fwserver.CallFunctionRequest 16 | // equivalent of a *tfprotov5.CallFunctionRequest. 17 | func CallFunctionRequest(ctx context.Context, proto *tfprotov5.CallFunctionRequest, function function.Function, functionDefinition function.Definition) (*fwserver.CallFunctionRequest, *function.FuncError) { 18 | if proto == nil { 19 | return nil, nil 20 | } 21 | 22 | fw := &fwserver.CallFunctionRequest{ 23 | Function: function, 24 | FunctionDefinition: functionDefinition, 25 | } 26 | 27 | arguments, funcError := ArgumentsData(ctx, proto.Arguments, functionDefinition) 28 | 29 | fw.Arguments = arguments 30 | 31 | return fw, funcError 32 | } 33 | -------------------------------------------------------------------------------- /internal/fromproto5/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fromproto5 contains functions to convert from protocol version 5 5 | // (tfprotov5) types to framework types. 6 | package fromproto5 7 | -------------------------------------------------------------------------------- /internal/fromproto5/getfunctions.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // GetFunctionsRequest returns the *fwserver.GetFunctionsRequest 14 | // equivalent of a *tfprotov5.GetFunctionsRequest. 15 | func GetFunctionsRequest(ctx context.Context, proto *tfprotov5.GetFunctionsRequest) *fwserver.GetFunctionsRequest { 16 | if proto == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetFunctionsRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto5/getmetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // GetMetadataRequest returns the *fwserver.GetMetadataRequest 14 | // equivalent of a *tfprotov5.GetMetadataRequest. 15 | func GetMetadataRequest(ctx context.Context, proto5 *tfprotov5.GetMetadataRequest) *fwserver.GetMetadataRequest { 16 | if proto5 == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetMetadataRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto5/getproviderschema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // GetProviderSchemaRequest returns the *fwserver.GetProviderSchemaRequest 14 | // equivalent of a *tfprotov5.GetProviderSchemaRequest. 15 | func GetProviderSchemaRequest(ctx context.Context, proto5 *tfprotov5.GetProviderSchemaRequest) *fwserver.GetProviderSchemaRequest { 16 | if proto5 == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetProviderSchemaRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto5/getresourceidentityschemas.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // GetResourceIdentitySchemasRequest returns the *fwserver.GetResourceIdentitySchemasRequest 14 | // equivalent of a *tfprotov5.GetResourceIdentitySchemasRequest. 15 | func GetResourceIdentitySchemasRequest(ctx context.Context, proto5 *tfprotov5.GetResourceIdentitySchemasRequest) *fwserver.GetResourceIdentitySchemasRequest { 16 | if proto5 == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetResourceIdentitySchemasRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto5/prepareproviderconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 13 | ) 14 | 15 | // PrepareProviderConfigRequest returns the *fwserver.ValidateProviderConfigRequest 16 | // equivalent of a *tfprotov5.PrepareProviderConfigRequest. 17 | func PrepareProviderConfigRequest(ctx context.Context, proto5 *tfprotov5.PrepareProviderConfigRequest, providerSchema fwschema.Schema) (*fwserver.ValidateProviderConfigRequest, diag.Diagnostics) { 18 | if proto5 == nil { 19 | return nil, nil 20 | } 21 | 22 | fw := &fwserver.ValidateProviderConfigRequest{} 23 | 24 | config, diags := Config(ctx, proto5.Config, providerSchema) 25 | 26 | fw.Config = config 27 | 28 | return fw, diags 29 | } 30 | -------------------------------------------------------------------------------- /internal/fromproto5/rawstate_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto5_test 5 | 6 | import ( 7 | "encoding/json" 8 | "testing" 9 | 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 12 | ) 13 | 14 | func testNewTfprotov5RawState(t *testing.T, jsonMap map[string]interface{}) *tfprotov5.RawState { 15 | t.Helper() 16 | 17 | rawStateJSON, err := json.Marshal(jsonMap) 18 | 19 | if err != nil { 20 | t.Fatalf("unable to create RawState JSON: %s", err) 21 | } 22 | 23 | return &tfprotov5.RawState{ 24 | JSON: rawStateJSON, 25 | } 26 | } 27 | 28 | func testNewTfprotov6RawState(t *testing.T, jsonMap map[string]interface{}) *tfprotov6.RawState { 29 | t.Helper() 30 | 31 | rawStateJSON, err := json.Marshal(jsonMap) 32 | 33 | if err != nil { 34 | t.Fatalf("unable to create RawState JSON: %s", err) 35 | } 36 | 37 | return &tfprotov6.RawState{ 38 | JSON: rawStateJSON, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /internal/fromproto6/callfunction.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/function" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 13 | ) 14 | 15 | // CallFunctionRequest returns the *fwserver.CallFunctionRequest 16 | // equivalent of a *tfprotov6.CallFunctionRequest. 17 | func CallFunctionRequest(ctx context.Context, proto *tfprotov6.CallFunctionRequest, function function.Function, functionDefinition function.Definition) (*fwserver.CallFunctionRequest, *function.FuncError) { 18 | if proto == nil { 19 | return nil, nil 20 | } 21 | 22 | fw := &fwserver.CallFunctionRequest{ 23 | Function: function, 24 | FunctionDefinition: functionDefinition, 25 | } 26 | 27 | arguments, funcError := ArgumentsData(ctx, proto.Arguments, functionDefinition) 28 | 29 | fw.Arguments = arguments 30 | 31 | return fw, funcError 32 | } 33 | -------------------------------------------------------------------------------- /internal/fromproto6/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fromproto6 contains functions to convert from protocol version 6 5 | // (tfprotov6) types to framework types. 6 | package fromproto6 7 | -------------------------------------------------------------------------------- /internal/fromproto6/getfunctions.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // GetFunctionsRequest returns the *fwserver.GetFunctionsRequest 14 | // equivalent of a *tfprotov6.GetFunctionsRequest. 15 | func GetFunctionsRequest(ctx context.Context, proto *tfprotov6.GetFunctionsRequest) *fwserver.GetFunctionsRequest { 16 | if proto == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetFunctionsRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto6/getmetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // GetMetadataRequest returns the *fwserver.GetMetadataRequest 14 | // equivalent of a *tfprotov6.GetMetadataRequest. 15 | func GetMetadataRequest(ctx context.Context, proto6 *tfprotov6.GetMetadataRequest) *fwserver.GetMetadataRequest { 16 | if proto6 == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetMetadataRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto6/getproviderschema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // GetProviderSchemaRequest returns the *fwserver.GetProviderSchemaRequest 14 | // equivalent of a *tfprotov6.GetProviderSchemaRequest. 15 | func GetProviderSchemaRequest(ctx context.Context, proto6 *tfprotov6.GetProviderSchemaRequest) *fwserver.GetProviderSchemaRequest { 16 | if proto6 == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetProviderSchemaRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto6/getresourceidentityschemas.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // GetResourceIdentitySchemasRequest returns the *fwserver.GetResourceIdentitySchemasRequest 14 | // equivalent of a *tfprotov6.GetResourceIdentitySchemasRequest. 15 | func GetResourceIdentitySchemasRequest(ctx context.Context, proto6 *tfprotov6.GetResourceIdentitySchemasRequest) *fwserver.GetResourceIdentitySchemasRequest { 16 | if proto6 == nil { 17 | return nil 18 | } 19 | 20 | fw := &fwserver.GetResourceIdentitySchemasRequest{} 21 | 22 | return fw 23 | } 24 | -------------------------------------------------------------------------------- /internal/fromproto6/rawstate_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto6_test 5 | 6 | import ( 7 | "encoding/json" 8 | "testing" 9 | 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | func testNewRawState(t *testing.T, jsonMap map[string]interface{}) *tfprotov6.RawState { 14 | t.Helper() 15 | 16 | rawStateJSON, err := json.Marshal(jsonMap) 17 | 18 | if err != nil { 19 | t.Fatalf("unable to create RawState JSON: %s", err) 20 | } 21 | 22 | return &tfprotov6.RawState{ 23 | JSON: rawStateJSON, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /internal/fromproto6/validateproviderconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 13 | ) 14 | 15 | // ValidateProviderConfigRequest returns the *fwserver.ValidateProviderConfigRequest 16 | // equivalent of a *tfprotov6.ValidateProviderConfigRequest. 17 | func ValidateProviderConfigRequest(ctx context.Context, proto6 *tfprotov6.ValidateProviderConfigRequest, providerSchema fwschema.Schema) (*fwserver.ValidateProviderConfigRequest, diag.Diagnostics) { 18 | if proto6 == nil { 19 | return nil, nil 20 | } 21 | 22 | fw := &fwserver.ValidateProviderConfigRequest{} 23 | 24 | config, diags := Config(ctx, proto6.Config, providerSchema) 25 | 26 | fw.Config = config 27 | 28 | return fw, diags 29 | } 30 | -------------------------------------------------------------------------------- /internal/fromtftypes/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fromtftypes contains functions to convert from terraform-plugin-go 5 | // tftypes types to framework types. 6 | package fromtftypes 7 | -------------------------------------------------------------------------------- /internal/fromtftypes/value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fromtftypes 5 | 6 | import ( 7 | "context" 8 | "fmt" 9 | 10 | "github.com/hashicorp/terraform-plugin-framework/attr" 11 | "github.com/hashicorp/terraform-plugin-go/tftypes" 12 | ) 13 | 14 | // Value returns the attr.Value equivalent to the tftypes.Value. 15 | func Value(ctx context.Context, tfType tftypes.Value, attrType attr.Type) (attr.Value, error) { 16 | if attrType == nil { 17 | return nil, fmt.Errorf("unable to convert tftypes.Value (%s) to attr.Value: missing attr.Type", tfType.String()) 18 | } 19 | 20 | attrValue, err := attrType.ValueFromTerraform(ctx, tfType) 21 | 22 | if err != nil { 23 | return nil, fmt.Errorf("unable to convert tftypes.Value (%s) to attr.Value: %w", tfType.String(), err) 24 | } 25 | 26 | return attrValue, nil 27 | } 28 | -------------------------------------------------------------------------------- /internal/fwfunction/diagnostics.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwfunction 5 | 6 | import ( 7 | "fmt" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | ) 11 | 12 | func MissingParameterNameDiag(functionName string, position *int64) diag.Diagnostic { 13 | if position == nil { 14 | return diag.NewErrorDiagnostic( 15 | "Invalid Function Definition", 16 | "When validating the function definition, an implementation issue was found. "+ 17 | "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ 18 | fmt.Sprintf("Function %q - The variadic parameter does not have a name", functionName), 19 | ) 20 | } 21 | 22 | return diag.NewErrorDiagnostic( 23 | "Invalid Function Definition", 24 | "When validating the function definition, an implementation issue was found. "+ 25 | "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ 26 | fmt.Sprintf("Function %q - Parameter at position %d does not have a name", functionName, *position), 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /internal/fwfunction/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fwfunction contains shared interfaces and structures for implementing behaviors 5 | // in Terraform Provider function implementations. 6 | package fwfunction 7 | -------------------------------------------------------------------------------- /internal/fwschema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fwschema implements shared logic for describing the structure, 5 | // data types, and behaviors of framework data for data sources, providers, 6 | // and resources. 7 | // 8 | // Refer to the internal/fwschemadata package for logic built on values based 9 | // on this schema information. 10 | package fwschema 11 | -------------------------------------------------------------------------------- /internal/fwschema/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwschema 5 | 6 | import "errors" 7 | 8 | var ( 9 | // ErrPathInsideAtomicAttribute is used when AttributeAtPath is called 10 | // on a path that doesn't have a schema associated with it, because 11 | // it's an element, attribute, or block of a complex type, not a nested 12 | // attribute. 13 | ErrPathInsideAtomicAttribute = errors.New("path leads to element, attribute, or block of a schema.Attribute that has no schema associated with it") 14 | 15 | // ErrPathIsBlock is used when AttributeAtPath is called on a path is a 16 | // block, not an attribute. Use blockAtPath on the path instead. 17 | ErrPathIsBlock = errors.New("path leads to block, not an attribute") 18 | 19 | // ErrPathInsideDynamicAttribute is used when AttributeAtPath is called on a path that doesn't 20 | // have a schema associated with it because it's nested in a dynamic attribute. 21 | ErrPathInsideDynamicAttribute = errors.New("path leads to element or attribute nested in a schema.DynamicAttribute") 22 | ) 23 | -------------------------------------------------------------------------------- /internal/fwschema/fwxschema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fwxschema implements extra framework-based schema 5 | // functionality on top of base Terraform attribute functionality. 6 | // 7 | // This package is separated from fwschema to prevent import cycles 8 | // with existing tfsdk functionality. 9 | package fwxschema 10 | -------------------------------------------------------------------------------- /internal/fwschema/fwxschema/nested_attribute_object_plan_modification.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwxschema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 9 | ) 10 | 11 | // NestedAttributeObjectWithPlanModifiers is an optional interface on 12 | // NestedAttributeObject which enables Object plan modification support. 13 | type NestedAttributeObjectWithPlanModifiers interface { 14 | fwschema.NestedAttributeObject 15 | 16 | // ObjectPlanModifiers should return a list of Object plan modifiers. 17 | ObjectPlanModifiers() []planmodifier.Object 18 | } 19 | -------------------------------------------------------------------------------- /internal/fwschema/fwxschema/nested_attribute_object_validation.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwxschema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | "github.com/hashicorp/terraform-plugin-framework/schema/validator" 9 | ) 10 | 11 | // NestedAttributeObjectWithValidators is an optional interface on 12 | // NestedAttributeObject which enables Object validation support. 13 | type NestedAttributeObjectWithValidators interface { 14 | fwschema.NestedAttributeObject 15 | 16 | // ObjectValidators should return a list of Object validators. 17 | ObjectValidators() []validator.Object 18 | } 19 | -------------------------------------------------------------------------------- /internal/fwschema/fwxschema/nested_block_object_plan_modification.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwxschema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 9 | ) 10 | 11 | // NestedBlockObjectWithPlanModifiers is an optional interface on 12 | // NestedBlockObject which enables Object plan modification support. 13 | type NestedBlockObjectWithPlanModifiers interface { 14 | fwschema.NestedBlockObject 15 | 16 | // ObjectPlanModifiers should return a list of Object plan modifiers. 17 | ObjectPlanModifiers() []planmodifier.Object 18 | } 19 | -------------------------------------------------------------------------------- /internal/fwschema/fwxschema/nested_block_object_validators.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwxschema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | "github.com/hashicorp/terraform-plugin-framework/schema/validator" 9 | ) 10 | 11 | // NestedBlockObjectWithValidators is an optional interface on 12 | // NestedBlockObject which enables Object validation support. 13 | type NestedBlockObjectWithValidators interface { 14 | fwschema.NestedBlockObject 15 | 16 | // ObjectValidators should return a list of Object validators. 17 | ObjectValidators() []validator.Object 18 | } 19 | -------------------------------------------------------------------------------- /internal/fwschemadata/data.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwschemadata 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | "github.com/hashicorp/terraform-plugin-go/tftypes" 9 | ) 10 | 11 | // Data is the shared storage implementation for schema-based values, such as 12 | // configuration, plan, and state. 13 | type Data struct { 14 | // Description contains the human friendly type of the data. Used in error 15 | // diagnostics. 16 | Description DataDescription 17 | 18 | // Schema contains the data structure and types for the value. 19 | Schema fwschema.Schema 20 | 21 | // TerraformValue contains the terraform-plugin-go value implementation. 22 | // 23 | // TODO: In the future this may be migrated to attr.Value, or more 24 | // succinctly, types.Object. 25 | // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/172 26 | TerraformValue tftypes.Value 27 | } 28 | -------------------------------------------------------------------------------- /internal/fwschemadata/data_get.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwschemadata 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/reflect" 11 | "github.com/hashicorp/terraform-plugin-framework/path" 12 | ) 13 | 14 | // Get populates the struct passed as `target` with the entire state. 15 | func (d Data) Get(ctx context.Context, target any) diag.Diagnostics { 16 | return reflect.Into(ctx, d.Schema.Type(), d.TerraformValue, target, reflect.Options{}, path.Empty()) 17 | } 18 | -------------------------------------------------------------------------------- /internal/fwschemadata/data_terraform_value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwschemadata 5 | 6 | import ( 7 | "context" 8 | "fmt" 9 | 10 | "github.com/hashicorp/terraform-plugin-go/tftypes" 11 | ) 12 | 13 | // TerraformValueAtTerraformPath returns the tftypes.Value at a given 14 | // tftypes.AttributePath or an error. 15 | func (d Data) TerraformValueAtTerraformPath(_ context.Context, path *tftypes.AttributePath) (tftypes.Value, error) { 16 | rawValue, remaining, err := tftypes.WalkAttributePath(d.TerraformValue, path) 17 | 18 | if err != nil { 19 | return tftypes.Value{}, fmt.Errorf("%v still remains in the path: %w", remaining, err) 20 | } 21 | 22 | attrValue, ok := rawValue.(tftypes.Value) 23 | 24 | if !ok { 25 | return tftypes.Value{}, fmt.Errorf("got non-tftypes.Value result %v", rawValue) 26 | } 27 | 28 | return attrValue, err 29 | } 30 | -------------------------------------------------------------------------------- /internal/fwschemadata/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fwschemadata implements the shared schema-based data implementation 5 | // for configuration, plan, and state values. 6 | package fwschemadata 7 | -------------------------------------------------------------------------------- /internal/fwschemadata/pointer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwschemadata_test 5 | 6 | func pointer[T any](value T) *T { 7 | return &value 8 | } 9 | -------------------------------------------------------------------------------- /internal/fwserver/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fwserver contains the framework provider server implementation. 5 | // This package should only ever contain framework-native types, while specific 6 | // protocol version compatible implementations, such as proto6server, are 7 | // implemented on top of this abstraction. 8 | package fwserver 9 | -------------------------------------------------------------------------------- /internal/fwserver/proto6_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package fwserver_test 5 | 6 | import ( 7 | "encoding/json" 8 | "testing" 9 | 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | func testNewRawState(t *testing.T, jsonMap map[string]interface{}) *tfprotov6.RawState { 14 | t.Helper() 15 | 16 | rawStateJSON, err := json.Marshal(jsonMap) 17 | 18 | if err != nil { 19 | t.Fatalf("unable to create RawState JSON: %s", err) 20 | } 21 | 22 | return &tfprotov6.RawState{ 23 | JSON: rawStateJSON, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /internal/fwtype/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package fwtype implements shared logic for interacting with the framework type system. 5 | package fwtype 6 | -------------------------------------------------------------------------------- /internal/logging/context.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package logging 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-log/tfsdklog" 10 | ) 11 | 12 | // InitContext creates SDK logger contexts. The incoming context will 13 | // already have the root SDK logger and root provider logger setup from 14 | // terraform-plugin-go tf6server RPC handlers. 15 | func InitContext(ctx context.Context) context.Context { 16 | ctx = tfsdklog.NewSubsystem(ctx, SubsystemFramework, 17 | // All calls are through the Framework* helper functions 18 | tfsdklog.WithAdditionalLocationOffset(1), 19 | tfsdklog.WithLevelFromEnv(EnvTfLogSdkFramework), 20 | // Propagate tf_req_id, tf_rpc, etc. fields 21 | tfsdklog.WithRootFields(), 22 | ) 23 | 24 | return ctx 25 | } 26 | -------------------------------------------------------------------------------- /internal/logging/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package logging contains framework internal helpers for consistent logger 5 | // and log entry handling. 6 | package logging 7 | -------------------------------------------------------------------------------- /internal/logging/environment_variables.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package logging 5 | 6 | // Environment variables. 7 | const ( 8 | // EnvTfLogSdkFramework is an environment variable that sets the logging 9 | // level of SDK framework loggers. Infers root SDK logging level, if 10 | // unset. 11 | EnvTfLogSdkFramework = "TF_LOG_SDK_FRAMEWORK" 12 | ) 13 | -------------------------------------------------------------------------------- /internal/privatestate/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package privatestate contains the type used for handling private resource 5 | // state data. 6 | package privatestate 7 | -------------------------------------------------------------------------------- /internal/proto5server/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package proto5server contains the provider server implementation compatible 5 | // with protocol version 5 (tfprotov5.ProviderServer). 6 | package proto5server 7 | -------------------------------------------------------------------------------- /internal/proto5server/server_getfunctions.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package proto5server 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fromproto5" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/logging" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/toproto5" 13 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 14 | ) 15 | 16 | // GetFunctions satisfies the tfprotov5.ProviderServer interface. 17 | func (s *Server) GetFunctions(ctx context.Context, protoReq *tfprotov5.GetFunctionsRequest) (*tfprotov5.GetFunctionsResponse, error) { 18 | ctx = s.registerContext(ctx) 19 | ctx = logging.InitContext(ctx) 20 | 21 | fwReq := fromproto5.GetFunctionsRequest(ctx, protoReq) 22 | fwResp := &fwserver.GetFunctionsResponse{} 23 | 24 | s.FrameworkServer.GetFunctions(ctx, fwReq, fwResp) 25 | 26 | return toproto5.GetFunctionsResponse(ctx, fwResp), nil 27 | } 28 | -------------------------------------------------------------------------------- /internal/proto5server/server_getmetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package proto5server 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fromproto5" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/logging" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/toproto5" 13 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 14 | ) 15 | 16 | // GetMetadata satisfies the tfprotov5.ProviderServer interface. 17 | func (s *Server) GetMetadata(ctx context.Context, proto6Req *tfprotov5.GetMetadataRequest) (*tfprotov5.GetMetadataResponse, error) { 18 | ctx = s.registerContext(ctx) 19 | ctx = logging.InitContext(ctx) 20 | 21 | fwReq := fromproto5.GetMetadataRequest(ctx, proto6Req) 22 | fwResp := &fwserver.GetMetadataResponse{} 23 | 24 | s.FrameworkServer.GetMetadata(ctx, fwReq, fwResp) 25 | 26 | return toproto5.GetMetadataResponse(ctx, fwResp), nil 27 | } 28 | -------------------------------------------------------------------------------- /internal/proto5server/server_getproviderschema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package proto5server 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fromproto5" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/logging" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/toproto5" 13 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 14 | ) 15 | 16 | // GetProviderSchema satisfies the tfprotov5.ProviderServer interface. 17 | func (s *Server) GetProviderSchema(ctx context.Context, proto5Req *tfprotov5.GetProviderSchemaRequest) (*tfprotov5.GetProviderSchemaResponse, error) { 18 | ctx = s.registerContext(ctx) 19 | ctx = logging.InitContext(ctx) 20 | 21 | fwReq := fromproto5.GetProviderSchemaRequest(ctx, proto5Req) 22 | fwResp := &fwserver.GetProviderSchemaResponse{} 23 | 24 | s.FrameworkServer.GetProviderSchema(ctx, fwReq, fwResp) 25 | 26 | return toproto5.GetProviderSchemaResponse(ctx, fwResp), nil 27 | } 28 | -------------------------------------------------------------------------------- /internal/proto6server/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package proto6server contains the provider server implementation compatible 5 | // with protocol version 6 (tfprotov6.ProviderServer). 6 | package proto6server 7 | -------------------------------------------------------------------------------- /internal/proto6server/server_getfunctions.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package proto6server 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fromproto6" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/logging" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/toproto6" 13 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 14 | ) 15 | 16 | // GetFunctions satisfies the tfprotov6.ProviderServer interface. 17 | func (s *Server) GetFunctions(ctx context.Context, protoReq *tfprotov6.GetFunctionsRequest) (*tfprotov6.GetFunctionsResponse, error) { 18 | ctx = s.registerContext(ctx) 19 | ctx = logging.InitContext(ctx) 20 | 21 | fwReq := fromproto6.GetFunctionsRequest(ctx, protoReq) 22 | fwResp := &fwserver.GetFunctionsResponse{} 23 | 24 | s.FrameworkServer.GetFunctions(ctx, fwReq, fwResp) 25 | 26 | return toproto6.GetFunctionsResponse(ctx, fwResp), nil 27 | } 28 | -------------------------------------------------------------------------------- /internal/proto6server/server_getmetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package proto6server 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fromproto6" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/logging" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/toproto6" 13 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 14 | ) 15 | 16 | // GetMetadata satisfies the tfprotov6.ProviderServer interface. 17 | func (s *Server) GetMetadata(ctx context.Context, proto6Req *tfprotov6.GetMetadataRequest) (*tfprotov6.GetMetadataResponse, error) { 18 | ctx = s.registerContext(ctx) 19 | ctx = logging.InitContext(ctx) 20 | 21 | fwReq := fromproto6.GetMetadataRequest(ctx, proto6Req) 22 | fwResp := &fwserver.GetMetadataResponse{} 23 | 24 | s.FrameworkServer.GetMetadata(ctx, fwReq, fwResp) 25 | 26 | return toproto6.GetMetadataResponse(ctx, fwResp), nil 27 | } 28 | -------------------------------------------------------------------------------- /internal/proto6server/server_getproviderschema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package proto6server 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fromproto6" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/logging" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/toproto6" 13 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 14 | ) 15 | 16 | // GetProviderSchema satisfies the tfprotov6.ProviderServer interface. 17 | func (s *Server) GetProviderSchema(ctx context.Context, proto6Req *tfprotov6.GetProviderSchemaRequest) (*tfprotov6.GetProviderSchemaResponse, error) { 18 | ctx = s.registerContext(ctx) 19 | ctx = logging.InitContext(ctx) 20 | 21 | fwReq := fromproto6.GetProviderSchemaRequest(ctx, proto6Req) 22 | fwResp := &fwserver.GetProviderSchemaResponse{} 23 | 24 | s.FrameworkServer.GetProviderSchema(ctx, fwReq, fwResp) 25 | 26 | return toproto6.GetProviderSchemaResponse(ctx, fwResp), nil 27 | } 28 | -------------------------------------------------------------------------------- /internal/reflect/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package reflect contains the implementation for converting framework-defined 5 | // data into and from provider-defined Go types. 6 | package reflect 7 | -------------------------------------------------------------------------------- /internal/reflect/generic_attr_value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package reflect 5 | 6 | import ( 7 | "context" 8 | "reflect" 9 | 10 | "github.com/hashicorp/terraform-plugin-framework/attr" 11 | ) 12 | 13 | func IsGenericAttrValue(ctx context.Context, target interface{}) bool { 14 | return reflect.TypeOf((*attr.Value)(nil)) == reflect.TypeOf(target) 15 | } 16 | -------------------------------------------------------------------------------- /internal/reflect/options.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package reflect 5 | 6 | // Options provides configuration settings for how the reflection behavior 7 | // works, letting callers tweak different behaviors based on their needs. 8 | type Options struct { 9 | // UnhandledNullAsEmpty controls whether null values should be 10 | // translated into empty values without provider interaction, or if 11 | // they must be explicitly handled. 12 | UnhandledNullAsEmpty bool 13 | 14 | // UnhandledUnknownAsEmpty controls whether null values should be 15 | // translated into empty values without provider interaction, or if 16 | // they must be explicitly handled. 17 | UnhandledUnknownAsEmpty bool 18 | } 19 | -------------------------------------------------------------------------------- /internal/testing/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package testing contains internal framework helpers for unit testing. 5 | package testing 6 | -------------------------------------------------------------------------------- /internal/testing/planmodifiers/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package planmodifiers contains plan modifiers for testing. 5 | package planmodifiers 6 | -------------------------------------------------------------------------------- /internal/testing/testdefaults/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package testdefaults contains declarative resource/schema/defaults 5 | // implementations for unit testing. 6 | package testdefaults 7 | -------------------------------------------------------------------------------- /internal/testing/testplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package testplanmodifier contains declarative resource/schema/planmodifier 5 | // implementations for unit testing. 6 | package testplanmodifier 7 | -------------------------------------------------------------------------------- /internal/testing/testprovider/datasourcewithconfigure.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/datasource" 10 | ) 11 | 12 | var _ datasource.DataSource = &DataSourceWithConfigure{} 13 | var _ datasource.DataSourceWithConfigure = &DataSourceWithConfigure{} 14 | 15 | // Declarative datasource.DataSourceWithConfigure for unit testing. 16 | type DataSourceWithConfigure struct { 17 | *DataSource 18 | 19 | // DataSourceWithConfigure interface methods 20 | ConfigureMethod func(context.Context, datasource.ConfigureRequest, *datasource.ConfigureResponse) 21 | } 22 | 23 | // Configure satisfies the datasource.DataSourceWithConfigure interface. 24 | func (d *DataSourceWithConfigure) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { 25 | if d.ConfigureMethod == nil { 26 | return 27 | } 28 | 29 | d.ConfigureMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/datasourcewithconfigvalidators.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/datasource" 10 | ) 11 | 12 | var _ datasource.DataSource = &DataSourceWithConfigValidators{} 13 | var _ datasource.DataSourceWithConfigValidators = &DataSourceWithConfigValidators{} 14 | 15 | // Declarative datasource.DataSourceWithConfigValidators for unit testing. 16 | type DataSourceWithConfigValidators struct { 17 | *DataSource 18 | 19 | // DataSourceWithConfigValidators interface methods 20 | ConfigValidatorsMethod func(context.Context) []datasource.ConfigValidator 21 | } 22 | 23 | // ConfigValidators satisfies the datasource.DataSourceWithConfigValidators interface. 24 | func (p *DataSourceWithConfigValidators) ConfigValidators(ctx context.Context) []datasource.ConfigValidator { 25 | if p.ConfigValidatorsMethod == nil { 26 | return nil 27 | } 28 | 29 | return p.ConfigValidatorsMethod(ctx) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/datasourcewithvalidateconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/datasource" 10 | ) 11 | 12 | var _ datasource.DataSource = &DataSourceWithValidateConfig{} 13 | var _ datasource.DataSourceWithValidateConfig = &DataSourceWithValidateConfig{} 14 | 15 | // Declarative datasource.DataSourceWithValidateConfig for unit testing. 16 | type DataSourceWithValidateConfig struct { 17 | *DataSource 18 | 19 | // DataSourceWithValidateConfig interface methods 20 | ValidateConfigMethod func(context.Context, datasource.ValidateConfigRequest, *datasource.ValidateConfigResponse) 21 | } 22 | 23 | // ValidateConfig satisfies the datasource.DataSourceWithValidateConfig interface. 24 | func (p *DataSourceWithValidateConfig) ValidateConfig(ctx context.Context, req datasource.ValidateConfigRequest, resp *datasource.ValidateConfigResponse) { 25 | if p.ValidateConfigMethod == nil { 26 | return 27 | } 28 | 29 | p.ValidateConfigMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package testprovider contains a fully declarative provider for testing. 5 | package testprovider 6 | -------------------------------------------------------------------------------- /internal/testing/testprovider/ephemeralresourcewithclose.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/ephemeral" 10 | ) 11 | 12 | var _ ephemeral.EphemeralResource = &EphemeralResourceWithClose{} 13 | var _ ephemeral.EphemeralResourceWithClose = &EphemeralResourceWithClose{} 14 | 15 | // Declarative ephemeral.EphemeralResourceWithClose for unit testing. 16 | type EphemeralResourceWithClose struct { 17 | *EphemeralResource 18 | 19 | // EphemeralResourceWithClose interface methods 20 | CloseMethod func(context.Context, ephemeral.CloseRequest, *ephemeral.CloseResponse) 21 | } 22 | 23 | // Close satisfies the ephemeral.EphemeralResourceWithClose interface. 24 | func (p *EphemeralResourceWithClose) Close(ctx context.Context, req ephemeral.CloseRequest, resp *ephemeral.CloseResponse) { 25 | if p.CloseMethod == nil { 26 | return 27 | } 28 | 29 | p.CloseMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/ephemeralresourcewithconfigure.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/ephemeral" 10 | ) 11 | 12 | var _ ephemeral.EphemeralResource = &EphemeralResourceWithConfigure{} 13 | var _ ephemeral.EphemeralResourceWithConfigure = &EphemeralResourceWithConfigure{} 14 | 15 | // Declarative ephemeral.EphemeralResourceWithConfigure for unit testing. 16 | type EphemeralResourceWithConfigure struct { 17 | *EphemeralResource 18 | 19 | // EphemeralResourceWithConfigure interface methods 20 | ConfigureMethod func(context.Context, ephemeral.ConfigureRequest, *ephemeral.ConfigureResponse) 21 | } 22 | 23 | // Configure satisfies the ephemeral.EphemeralResourceWithConfigure interface. 24 | func (d *EphemeralResourceWithConfigure) Configure(ctx context.Context, req ephemeral.ConfigureRequest, resp *ephemeral.ConfigureResponse) { 25 | if d.ConfigureMethod == nil { 26 | return 27 | } 28 | 29 | d.ConfigureMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/ephemeralresourcewithconfigvalidators.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/ephemeral" 10 | ) 11 | 12 | var _ ephemeral.EphemeralResource = &EphemeralResourceWithConfigValidators{} 13 | var _ ephemeral.EphemeralResourceWithConfigValidators = &EphemeralResourceWithConfigValidators{} 14 | 15 | // Declarative ephemeral.EphemeralResourceWithConfigValidators for unit testing. 16 | type EphemeralResourceWithConfigValidators struct { 17 | *EphemeralResource 18 | 19 | // EphemeralResourceWithConfigValidators interface methods 20 | ConfigValidatorsMethod func(context.Context) []ephemeral.ConfigValidator 21 | } 22 | 23 | // ConfigValidators satisfies the ephemeral.EphemeralResourceWithConfigValidators interface. 24 | func (p *EphemeralResourceWithConfigValidators) ConfigValidators(ctx context.Context) []ephemeral.ConfigValidator { 25 | if p.ConfigValidatorsMethod == nil { 26 | return nil 27 | } 28 | 29 | return p.ConfigValidatorsMethod(ctx) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/ephemeralresourcewithrenew.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/ephemeral" 10 | ) 11 | 12 | var _ ephemeral.EphemeralResource = &EphemeralResourceWithRenew{} 13 | var _ ephemeral.EphemeralResourceWithRenew = &EphemeralResourceWithRenew{} 14 | 15 | // Declarative ephemeral.EphemeralResourceWithRenew for unit testing. 16 | type EphemeralResourceWithRenew struct { 17 | *EphemeralResource 18 | 19 | // EphemeralResourceWithRenew interface methods 20 | RenewMethod func(context.Context, ephemeral.RenewRequest, *ephemeral.RenewResponse) 21 | } 22 | 23 | // Renew satisfies the ephemeral.EphemeralResourceWithRenew interface. 24 | func (p *EphemeralResourceWithRenew) Renew(ctx context.Context, req ephemeral.RenewRequest, resp *ephemeral.RenewResponse) { 25 | if p.RenewMethod == nil { 26 | return 27 | } 28 | 29 | p.RenewMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/providerwithconfigvalidators.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/provider" 10 | ) 11 | 12 | var _ provider.Provider = &ProviderWithConfigValidators{} 13 | var _ provider.ProviderWithConfigValidators = &ProviderWithConfigValidators{} 14 | 15 | // Declarative provider.ProviderWithConfigValidators for unit testing. 16 | type ProviderWithConfigValidators struct { 17 | *Provider 18 | 19 | // ProviderWithConfigValidators interface methods 20 | ConfigValidatorsMethod func(context.Context) []provider.ConfigValidator 21 | } 22 | 23 | // GetMetaSchema satisfies the provider.ProviderWithConfigValidators interface. 24 | func (p *ProviderWithConfigValidators) ConfigValidators(ctx context.Context) []provider.ConfigValidator { 25 | if p.ConfigValidatorsMethod == nil { 26 | return nil 27 | } 28 | 29 | return p.ConfigValidatorsMethod(ctx) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/providerwithfunctions.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/function" 10 | "github.com/hashicorp/terraform-plugin-framework/provider" 11 | ) 12 | 13 | var ( 14 | _ provider.Provider = &ProviderWithFunctions{} 15 | _ provider.ProviderWithFunctions = &ProviderWithFunctions{} 16 | ) 17 | 18 | // Declarative provider.ProviderWithFunctions for unit testing. 19 | type ProviderWithFunctions struct { 20 | *Provider 21 | 22 | // ProviderWithFunctions interface methods 23 | FunctionsMethod func(context.Context) []func() function.Function 24 | } 25 | 26 | // Functions satisfies the provider.ProviderWithFunctions interface. 27 | func (p *ProviderWithFunctions) Functions(ctx context.Context) []func() function.Function { 28 | if p.FunctionsMethod == nil { 29 | return nil 30 | } 31 | 32 | return p.FunctionsMethod(ctx) 33 | } 34 | -------------------------------------------------------------------------------- /internal/testing/testprovider/providerwithmetaschema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/provider" 10 | ) 11 | 12 | var _ provider.Provider = &ProviderWithMetaSchema{} 13 | var _ provider.ProviderWithMetaSchema = &ProviderWithMetaSchema{} 14 | 15 | // Declarative provider.ProviderWithMetaSchema for unit testing. 16 | type ProviderWithMetaSchema struct { 17 | *Provider 18 | 19 | // ProviderWithMetaSchema interface methods 20 | MetaSchemaMethod func(context.Context, provider.MetaSchemaRequest, *provider.MetaSchemaResponse) 21 | } 22 | 23 | // MetaSchema satisfies the provider.ProviderWithMetaSchema interface. 24 | func (p *ProviderWithMetaSchema) MetaSchema(ctx context.Context, req provider.MetaSchemaRequest, resp *provider.MetaSchemaResponse) { 25 | if p.MetaSchemaMethod == nil { 26 | return 27 | } 28 | 29 | p.MetaSchemaMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/providerwithvalidateconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/provider" 10 | ) 11 | 12 | var _ provider.Provider = &ProviderWithValidateConfig{} 13 | var _ provider.ProviderWithValidateConfig = &ProviderWithValidateConfig{} 14 | 15 | // Declarative provider.ProviderWithValidateConfig for unit testing. 16 | type ProviderWithValidateConfig struct { 17 | *Provider 18 | 19 | // ProviderWithValidateConfig interface methods 20 | ValidateConfigMethod func(context.Context, provider.ValidateConfigRequest, *provider.ValidateConfigResponse) 21 | } 22 | 23 | // GetMetaSchema satisfies the provider.ProviderWithValidateConfig interface. 24 | func (p *ProviderWithValidateConfig) ValidateConfig(ctx context.Context, req provider.ValidateConfigRequest, resp *provider.ValidateConfigResponse) { 25 | if p.ValidateConfigMethod == nil { 26 | return 27 | } 28 | 29 | p.ValidateConfigMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithconfigure.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithConfigure{} 13 | var _ resource.ResourceWithConfigure = &ResourceWithConfigure{} 14 | 15 | // Declarative resource.ResourceWithConfigure for unit testing. 16 | type ResourceWithConfigure struct { 17 | *Resource 18 | 19 | // ResourceWithConfigure interface methods 20 | ConfigureMethod func(context.Context, resource.ConfigureRequest, *resource.ConfigureResponse) 21 | } 22 | 23 | // Configure satisfies the resource.ResourceWithConfigure interface. 24 | func (r *ResourceWithConfigure) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { 25 | if r.ConfigureMethod == nil { 26 | return 27 | } 28 | 29 | r.ConfigureMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithconfigvalidators.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithConfigValidators{} 13 | var _ resource.ResourceWithConfigValidators = &ResourceWithConfigValidators{} 14 | 15 | // Declarative resource.ResourceWithConfigValidators for unit testing. 16 | type ResourceWithConfigValidators struct { 17 | *Resource 18 | 19 | // ResourceWithConfigValidators interface methods 20 | ConfigValidatorsMethod func(context.Context) []resource.ConfigValidator 21 | } 22 | 23 | // ConfigValidators satisfies the resource.ResourceWithConfigValidators interface. 24 | func (p *ResourceWithConfigValidators) ConfigValidators(ctx context.Context) []resource.ConfigValidator { 25 | if p.ConfigValidatorsMethod == nil { 26 | return nil 27 | } 28 | 29 | return p.ConfigValidatorsMethod(ctx) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithidentity.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithIdentity{} 13 | var _ resource.ResourceWithIdentity = &ResourceWithIdentity{} 14 | 15 | // Declarative resource.ResourceWithIdentity for unit testing. 16 | type ResourceWithIdentity struct { 17 | *Resource 18 | 19 | // ResourceWithIdentity interface methods 20 | IdentitySchemaMethod func(context.Context, resource.IdentitySchemaRequest, *resource.IdentitySchemaResponse) 21 | } 22 | 23 | // IdentitySchema implements resource.ResourceWithIdentity. 24 | func (p *ResourceWithIdentity) IdentitySchema(ctx context.Context, req resource.IdentitySchemaRequest, resp *resource.IdentitySchemaResponse) { 25 | if p.IdentitySchemaMethod == nil { 26 | return 27 | } 28 | 29 | p.IdentitySchemaMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithimportstate.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithImportState{} 13 | var _ resource.ResourceWithImportState = &ResourceWithImportState{} 14 | 15 | // Declarative resource.ResourceWithImportState for unit testing. 16 | type ResourceWithImportState struct { 17 | *Resource 18 | 19 | // ResourceWithImportState interface methods 20 | ImportStateMethod func(context.Context, resource.ImportStateRequest, *resource.ImportStateResponse) 21 | } 22 | 23 | // ImportState satisfies the resource.ResourceWithImportState interface. 24 | func (p *ResourceWithImportState) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { 25 | if p.ImportStateMethod == nil { 26 | return 27 | } 28 | 29 | p.ImportStateMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithmodifyplan.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithModifyPlan{} 13 | var _ resource.ResourceWithModifyPlan = &ResourceWithModifyPlan{} 14 | 15 | // Declarative resource.ResourceWithModifyPlan for unit testing. 16 | type ResourceWithModifyPlan struct { 17 | *Resource 18 | 19 | // ResourceWithModifyPlan interface methods 20 | ModifyPlanMethod func(context.Context, resource.ModifyPlanRequest, *resource.ModifyPlanResponse) 21 | } 22 | 23 | // ModifyPlan satisfies the resource.ResourceWithModifyPlan interface. 24 | func (p *ResourceWithModifyPlan) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { 25 | if p.ModifyPlanMethod == nil { 26 | return 27 | } 28 | 29 | p.ModifyPlanMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithmovestate.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithMoveState{} 13 | var _ resource.ResourceWithMoveState = &ResourceWithMoveState{} 14 | 15 | // Declarative resource.ResourceWithMoveState for unit testing. 16 | type ResourceWithMoveState struct { 17 | *Resource 18 | 19 | // ResourceWithMoveState interface methods 20 | MoveStateMethod func(context.Context) []resource.StateMover 21 | } 22 | 23 | // MoveState satisfies the resource.ResourceWithMoveState interface. 24 | func (p *ResourceWithMoveState) MoveState(ctx context.Context) []resource.StateMover { 25 | if p.MoveStateMethod == nil { 26 | return nil 27 | } 28 | 29 | return p.MoveStateMethod(ctx) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithupgradestate.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithUpgradeState{} 13 | var _ resource.ResourceWithUpgradeState = &ResourceWithUpgradeState{} 14 | 15 | // Declarative resource.ResourceWithUpgradeState for unit testing. 16 | type ResourceWithUpgradeState struct { 17 | *Resource 18 | 19 | // ResourceWithUpgradeState interface methods 20 | UpgradeStateMethod func(context.Context) map[int64]resource.StateUpgrader 21 | } 22 | 23 | // UpgradeState satisfies the resource.ResourceWithUpgradeState interface. 24 | func (p *ResourceWithUpgradeState) UpgradeState(ctx context.Context) map[int64]resource.StateUpgrader { 25 | if p.UpgradeStateMethod == nil { 26 | return nil 27 | } 28 | 29 | return p.UpgradeStateMethod(ctx) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testprovider/resourcewithvalidateconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testprovider 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | var _ resource.Resource = &ResourceWithValidateConfig{} 13 | var _ resource.ResourceWithValidateConfig = &ResourceWithValidateConfig{} 14 | 15 | // Declarative resource.ResourceWithValidateConfig for unit testing. 16 | type ResourceWithValidateConfig struct { 17 | *Resource 18 | 19 | // ResourceWithValidateConfig interface methods 20 | ValidateConfigMethod func(context.Context, resource.ValidateConfigRequest, *resource.ValidateConfigResponse) 21 | } 22 | 23 | // ValidateConfig satisfies the resource.ResourceWithValidateConfig interface. 24 | func (p *ResourceWithValidateConfig) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) { 25 | if p.ValidateConfigMethod == nil { 26 | return 27 | } 28 | 29 | p.ValidateConfigMethod(ctx, req, resp) 30 | } 31 | -------------------------------------------------------------------------------- /internal/testing/testschema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package testschema contains declarative schema types for unit testing. 5 | package testschema 6 | -------------------------------------------------------------------------------- /internal/testing/testtypes/diags.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/path" 9 | ) 10 | 11 | func TestErrorDiagnostic(path path.Path) diag.DiagnosticWithPath { 12 | return diag.NewAttributeErrorDiagnostic( 13 | path, 14 | "Error Diagnostic", 15 | "This is an error.", 16 | ) 17 | } 18 | 19 | func TestWarningDiagnostic(path path.Path) diag.DiagnosticWithPath { 20 | return diag.NewAttributeWarningDiagnostic( 21 | path, 22 | "Warning Diagnostic", 23 | "This is a warning.", 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /internal/testing/testtypes/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // types contains shared attr.Type implementations for unit testing. 5 | package testtypes 6 | -------------------------------------------------------------------------------- /internal/testing/testtypes/dynamic.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.DynamicTypable = DynamicType{} 13 | _ basetypes.DynamicValuable = DynamicValue{} 14 | ) 15 | 16 | type DynamicType struct { 17 | basetypes.DynamicType 18 | } 19 | 20 | func (t DynamicType) Equal(o attr.Type) bool { 21 | other, ok := o.(DynamicType) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.DynamicType.Equal(other.DynamicType) 28 | } 29 | 30 | type DynamicValue struct { 31 | basetypes.DynamicValue 32 | } 33 | 34 | func (v DynamicValue) Equal(o attr.Value) bool { 35 | other, ok := o.(DynamicValue) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.DynamicValue.Equal(other.DynamicValue) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/float32.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.Float32Typable = Float32Type{} 13 | _ basetypes.Float32Valuable = Float32Value{} 14 | ) 15 | 16 | type Float32Type struct { 17 | basetypes.Float32Type 18 | } 19 | 20 | func (t Float32Type) Equal(o attr.Type) bool { 21 | other, ok := o.(Float32Type) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.Float32Type.Equal(other.Float32Type) 28 | } 29 | 30 | type Float32Value struct { 31 | basetypes.Float32Value 32 | } 33 | 34 | func (v Float32Value) Equal(o attr.Value) bool { 35 | other, ok := o.(Float32Value) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.Float32Value.Equal(other.Float32Value) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/float64.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.Float64Typable = Float64Type{} 13 | _ basetypes.Float64Valuable = Float64Value{} 14 | ) 15 | 16 | type Float64Type struct { 17 | basetypes.Float64Type 18 | } 19 | 20 | func (t Float64Type) Equal(o attr.Type) bool { 21 | other, ok := o.(Float64Type) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.Float64Type.Equal(other.Float64Type) 28 | } 29 | 30 | type Float64Value struct { 31 | basetypes.Float64Value 32 | } 33 | 34 | func (v Float64Value) Equal(o attr.Value) bool { 35 | other, ok := o.(Float64Value) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.Float64Value.Equal(other.Float64Value) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/int32.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.Int32Typable = Int32Type{} 13 | _ basetypes.Int32Valuable = Int32Value{} 14 | ) 15 | 16 | type Int32Type struct { 17 | basetypes.Int32Type 18 | } 19 | 20 | func (t Int32Type) Equal(o attr.Type) bool { 21 | other, ok := o.(Int32Type) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.Int32Type.Equal(other.Int32Type) 28 | } 29 | 30 | type Int32Value struct { 31 | basetypes.Int32Value 32 | } 33 | 34 | func (v Int32Value) Equal(o attr.Value) bool { 35 | other, ok := o.(Int32Value) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.Int32Value.Equal(other.Int32Value) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/int64.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.Int64Typable = Int64Type{} 13 | _ basetypes.Int64Valuable = Int64Value{} 14 | ) 15 | 16 | type Int64Type struct { 17 | basetypes.Int64Type 18 | } 19 | 20 | func (t Int64Type) Equal(o attr.Type) bool { 21 | other, ok := o.(Int64Type) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.Int64Type.Equal(other.Int64Type) 28 | } 29 | 30 | type Int64Value struct { 31 | basetypes.Int64Value 32 | } 33 | 34 | func (v Int64Value) Equal(o attr.Value) bool { 35 | other, ok := o.(Int64Value) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.Int64Value.Equal(other.Int64Value) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/list.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.ListTypable = ListType{} 13 | _ basetypes.ListValuable = ListValue{} 14 | ) 15 | 16 | type ListType struct { 17 | basetypes.ListType 18 | } 19 | 20 | func (t ListType) Equal(o attr.Type) bool { 21 | other, ok := o.(ListType) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.ListType.Equal(other.ListType) 28 | } 29 | 30 | type ListValue struct { 31 | basetypes.ListValue 32 | } 33 | 34 | func (v ListValue) Equal(o attr.Value) bool { 35 | other, ok := o.(ListValue) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.ListValue.Equal(other.ListValue) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/map.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.MapTypable = MapType{} 13 | _ basetypes.MapValuable = MapValue{} 14 | ) 15 | 16 | type MapType struct { 17 | basetypes.MapType 18 | } 19 | 20 | func (t MapType) Equal(o attr.Type) bool { 21 | other, ok := o.(MapType) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.MapType.Equal(other.MapType) 28 | } 29 | 30 | type MapValue struct { 31 | basetypes.MapValue 32 | } 33 | 34 | func (v MapValue) Equal(o attr.Value) bool { 35 | other, ok := o.(MapValue) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.MapValue.Equal(other.MapValue) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/object.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.ObjectTypable = ObjectType{} 13 | _ basetypes.ObjectValuable = ObjectValue{} 14 | ) 15 | 16 | type ObjectType struct { 17 | basetypes.ObjectType 18 | } 19 | 20 | func (t ObjectType) Equal(o attr.Type) bool { 21 | other, ok := o.(ObjectType) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.ObjectType.Equal(other.ObjectType) 28 | } 29 | 30 | type ObjectValue struct { 31 | basetypes.ObjectValue 32 | } 33 | 34 | func (v ObjectValue) Equal(o attr.Value) bool { 35 | other, ok := o.(ObjectValue) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.ObjectValue.Equal(other.ObjectValue) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testtypes/set.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package testtypes 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | var ( 12 | _ basetypes.SetTypable = SetType{} 13 | _ basetypes.SetValuable = SetValue{} 14 | ) 15 | 16 | type SetType struct { 17 | basetypes.SetType 18 | } 19 | 20 | func (t SetType) Equal(o attr.Type) bool { 21 | other, ok := o.(SetType) 22 | 23 | if !ok { 24 | return false 25 | } 26 | 27 | return t.SetType.Equal(other.SetType) 28 | } 29 | 30 | type SetValue struct { 31 | basetypes.SetValue 32 | } 33 | 34 | func (v SetValue) Equal(o attr.Value) bool { 35 | other, ok := o.(SetValue) 36 | 37 | if !ok { 38 | return false 39 | } 40 | 41 | return v.SetValue.Equal(other.SetValue) 42 | } 43 | -------------------------------------------------------------------------------- /internal/testing/testvalidator/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package testvalidator contains declarative schema/validator implementations 5 | // for unit testing. 6 | package testvalidator 7 | -------------------------------------------------------------------------------- /internal/toproto5/callfunction.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/function" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 13 | ) 14 | 15 | // CallFunctionResponse returns the *tfprotov5.CallFunctionResponse 16 | // equivalent of a *fwserver.CallFunctionResponse. 17 | func CallFunctionResponse(ctx context.Context, fw *fwserver.CallFunctionResponse) *tfprotov5.CallFunctionResponse { 18 | if fw == nil { 19 | return nil 20 | } 21 | 22 | result, resultErr := FunctionResultData(ctx, fw.Result) 23 | 24 | funcErr := function.ConcatFuncErrors(fw.Error, resultErr) 25 | 26 | return &tfprotov5.CallFunctionResponse{ 27 | Error: FunctionError(ctx, funcErr), 28 | Result: result, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto5/closeephemeralresource.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // CloseEphemeralResourceResponse returns the *tfprotov5.CloseEphemeralResourceResponse 14 | // equivalent of a *fwserver.CloseEphemeralResourceResponse. 15 | func CloseEphemeralResourceResponse(ctx context.Context, fw *fwserver.CloseEphemeralResourceResponse) *tfprotov5.CloseEphemeralResourceResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.CloseEphemeralResourceResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto5 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto5/config.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata" 11 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 13 | ) 14 | 15 | // Config returns the *tfprotov5.DynamicValue for a *tfsdk.Config. 16 | func Config(ctx context.Context, fw *tfsdk.Config) (*tfprotov5.DynamicValue, diag.Diagnostics) { 17 | if fw == nil { 18 | return nil, nil 19 | } 20 | 21 | data := &fwschemadata.Data{ 22 | Description: fwschemadata.DataDescriptionConfiguration, 23 | Schema: fw.Schema, 24 | TerraformValue: fw.Raw, 25 | } 26 | 27 | return DynamicValue(ctx, data) 28 | } 29 | -------------------------------------------------------------------------------- /internal/toproto5/configureprovider.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/provider" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // ConfigureProviderResponse returns the *tfprotov5.ConfigureProviderResponse 14 | // equivalent of a *fwserver.ConfigureProviderResponse. 15 | func ConfigureProviderResponse(ctx context.Context, fw *provider.ConfigureResponse) *tfprotov5.ConfigureProviderResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.ConfigureProviderResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto5 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto5/datasourcemetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // DataSourceMetadata returns the tfprotov5.DataSourceMetadata for a 14 | // fwserver.DataSourceMetadata. 15 | func DataSourceMetadata(ctx context.Context, fw fwserver.DataSourceMetadata) tfprotov5.DataSourceMetadata { 16 | return tfprotov5.DataSourceMetadata{ 17 | TypeName: fw.TypeName, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /internal/toproto5/deferred.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/datasource" 10 | "github.com/hashicorp/terraform-plugin-framework/ephemeral" 11 | "github.com/hashicorp/terraform-plugin-framework/resource" 12 | ) 13 | 14 | func DataSourceDeferred(fw *datasource.Deferred) *tfprotov5.Deferred { 15 | if fw == nil { 16 | return nil 17 | } 18 | return &tfprotov5.Deferred{ 19 | Reason: tfprotov5.DeferredReason(fw.Reason), 20 | } 21 | } 22 | 23 | func ResourceDeferred(fw *resource.Deferred) *tfprotov5.Deferred { 24 | if fw == nil { 25 | return nil 26 | } 27 | return &tfprotov5.Deferred{ 28 | Reason: tfprotov5.DeferredReason(fw.Reason), 29 | } 30 | } 31 | 32 | func EphemeralResourceDeferred(fw *ephemeral.Deferred) *tfprotov5.Deferred { 33 | if fw == nil { 34 | return nil 35 | } 36 | return &tfprotov5.Deferred{ 37 | Reason: tfprotov5.DeferredReason(fw.Reason), 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /internal/toproto5/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package toproto5 contains functions to convert from framework types to 5 | // protocol version 5 (tfprotov5) types. 6 | package toproto5 7 | -------------------------------------------------------------------------------- /internal/toproto5/ephemeral_result_data.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata" 11 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 13 | ) 14 | 15 | // EphemeralResultData returns the *tfprotov5.DynamicValue for a *tfsdk.EphemeralResultData. 16 | func EphemeralResultData(ctx context.Context, fw *tfsdk.EphemeralResultData) (*tfprotov5.DynamicValue, diag.Diagnostics) { 17 | if fw == nil { 18 | return nil, nil 19 | } 20 | 21 | data := &fwschemadata.Data{ 22 | Description: fwschemadata.DataDescriptionEphemeralResultData, 23 | Schema: fw.Schema, 24 | TerraformValue: fw.Raw, 25 | } 26 | 27 | return DynamicValue(ctx, data) 28 | } 29 | -------------------------------------------------------------------------------- /internal/toproto5/ephemeralresourcemetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // EphemeralResourceMetadata returns the tfprotov5.EphemeralResourceMetadata for a 14 | // fwserver.EphemeralResourceMetadata. 15 | func EphemeralResourceMetadata(ctx context.Context, fw fwserver.EphemeralResourceMetadata) tfprotov5.EphemeralResourceMetadata { 16 | return tfprotov5.EphemeralResourceMetadata{ 17 | TypeName: fw.TypeName, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /internal/toproto5/function_errors.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/function" 12 | ) 13 | 14 | // FunctionError converts the function error into the tfprotov5 function error. 15 | func FunctionError(ctx context.Context, funcErr *function.FuncError) *tfprotov5.FunctionError { 16 | if funcErr == nil { 17 | return nil 18 | } 19 | 20 | return &tfprotov5.FunctionError{ 21 | Text: funcErr.Text, 22 | FunctionArgument: funcErr.FunctionArgument, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /internal/toproto5/getfunctions.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // GetFunctionsResponse returns the *tfprotov5.GetFunctionsResponse 14 | // equivalent of a *fwserver.GetFunctionsResponse. 15 | func GetFunctionsResponse(ctx context.Context, fw *fwserver.GetFunctionsResponse) *tfprotov5.GetFunctionsResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto := &tfprotov5.GetFunctionsResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | Functions: make(map[string]*tfprotov5.Function, len(fw.FunctionDefinitions)), 23 | } 24 | 25 | for name, functionDefinition := range fw.FunctionDefinitions { 26 | proto.Functions[name] = Function(ctx, functionDefinition) 27 | } 28 | 29 | return proto 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto5/pointer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5_test 5 | 6 | func pointer[T any](value T) *T { 7 | return &value 8 | } 9 | -------------------------------------------------------------------------------- /internal/toproto5/prepareproviderconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // PrepareProviderConfigResponse returns the *tfprotov5.PrepareProviderConfigResponse 14 | // equivalent of a *fwserver.ValidateProviderConfigResponse. 15 | func PrepareProviderConfigResponse(ctx context.Context, fw *fwserver.ValidateProviderConfigResponse) *tfprotov5.PrepareProviderConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.PrepareProviderConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | preparedConfig, diags := Config(ctx, fw.PreparedConfig) 25 | 26 | proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...) 27 | proto5.PreparedConfig = preparedConfig 28 | 29 | return proto5 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto5/readdatasource.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 12 | ) 13 | 14 | // ReadDataSourceResponse returns the *tfprotov5.ReadDataSourceResponse 15 | // equivalent of a *fwserver.ReadDataSourceResponse. 16 | func ReadDataSourceResponse(ctx context.Context, fw *fwserver.ReadDataSourceResponse) *tfprotov5.ReadDataSourceResponse { 17 | if fw == nil { 18 | return nil 19 | } 20 | 21 | proto5 := &tfprotov5.ReadDataSourceResponse{ 22 | Deferred: DataSourceDeferred(fw.Deferred), 23 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 24 | } 25 | 26 | state, diags := State(ctx, fw.State) 27 | 28 | proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...) 29 | proto5.State = state 30 | 31 | return proto5 32 | } 33 | -------------------------------------------------------------------------------- /internal/toproto5/renewephemeralresource.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // RenewEphemeralResourceResponse returns the *tfprotov5.RenewEphemeralResourceResponse 14 | // equivalent of a *fwserver.RenewEphemeralResourceResponse. 15 | func RenewEphemeralResourceResponse(ctx context.Context, fw *fwserver.RenewEphemeralResourceResponse) *tfprotov5.RenewEphemeralResourceResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.RenewEphemeralResourceResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | RenewAt: fw.RenewAt, 23 | } 24 | 25 | newPrivate, diags := fw.Private.Bytes(ctx) 26 | 27 | proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...) 28 | proto5.Private = newPrivate 29 | 30 | return proto5 31 | } 32 | -------------------------------------------------------------------------------- /internal/toproto5/resourcemetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // ResourceMetadata returns the tfprotov5.ResourceMetadata for a 14 | // fwserver.ResourceMetadata. 15 | func ResourceMetadata(ctx context.Context, fw fwserver.ResourceMetadata) tfprotov5.ResourceMetadata { 16 | return tfprotov5.ResourceMetadata{ 17 | TypeName: fw.TypeName, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /internal/toproto5/server_capabilities.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // ServerCapabilities returns the *tfprotov5.ServerCapabilities for a 14 | // *fwserver.ServerCapabilities. 15 | func ServerCapabilities(ctx context.Context, fw *fwserver.ServerCapabilities) *tfprotov5.ServerCapabilities { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | return &tfprotov5.ServerCapabilities{ 21 | GetProviderSchemaOptional: fw.GetProviderSchemaOptional, 22 | MoveResourceState: fw.MoveResourceState, 23 | PlanDestroy: fw.PlanDestroy, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto5/state.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata" 11 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 13 | ) 14 | 15 | // State returns the *tfprotov5.DynamicValue for a *tfsdk.State. 16 | func State(ctx context.Context, fw *tfsdk.State) (*tfprotov5.DynamicValue, diag.Diagnostics) { 17 | if fw == nil { 18 | return nil, nil 19 | } 20 | 21 | data := &fwschemadata.Data{ 22 | Description: fwschemadata.DataDescriptionState, 23 | Schema: fw.Schema, 24 | TerraformValue: fw.Raw, 25 | } 26 | 27 | return DynamicValue(ctx, data) 28 | } 29 | -------------------------------------------------------------------------------- /internal/toproto5/upgraderesourceidentity.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // UpgradeResourceIdentityResponse returns the *tfprotov5.UpgradeResourceIdentityResponse 14 | // equivalent of a *fwserver.UpgradeResourceIdentityResponse. 15 | func UpgradeResourceIdentityResponse(ctx context.Context, fw *fwserver.UpgradeResourceIdentityResponse) *tfprotov5.UpgradeResourceIdentityResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.UpgradeResourceIdentityResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | upgradedIdentity, diags := ResourceIdentity(ctx, fw.UpgradedIdentity) 25 | 26 | proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...) 27 | proto5.UpgradedIdentity = upgradedIdentity 28 | 29 | return proto5 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto5/upgraderesourcestate.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // UpgradeResourceStateResponse returns the *tfprotov5.UpgradeResourceStateResponse 14 | // equivalent of a *fwserver.UpgradeResourceStateResponse. 15 | func UpgradeResourceStateResponse(ctx context.Context, fw *fwserver.UpgradeResourceStateResponse) *tfprotov5.UpgradeResourceStateResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.UpgradeResourceStateResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | upgradedState, diags := State(ctx, fw.UpgradedState) 25 | 26 | proto5.Diagnostics = append(proto5.Diagnostics, Diagnostics(ctx, diags)...) 27 | proto5.UpgradedState = upgradedState 28 | 29 | return proto5 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto5/validatedatasourceconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // ValidateDataSourceConfigResponse returns the *tfprotov5.ValidateDataSourceConfigResponse 14 | // equivalent of a *fwserver.ValidateDataSourceConfigResponse. 15 | func ValidateDataSourceConfigResponse(ctx context.Context, fw *fwserver.ValidateDataSourceConfigResponse) *tfprotov5.ValidateDataSourceConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.ValidateDataSourceConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto5 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto5/validateephemeralresourceconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // ValidateEphemeralResourceConfigResponse returns the *tfprotov5.ValidateEphemeralResourceConfigResponse 14 | // equivalent of a *fwserver.ValidateEphemeralResourceConfigResponse. 15 | func ValidateEphemeralResourceConfigResponse(ctx context.Context, fw *fwserver.ValidateEphemeralResourceConfigResponse) *tfprotov5.ValidateEphemeralResourceConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.ValidateEphemeralResourceConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto5 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto5/validateresourcetypeconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto5 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov5" 11 | ) 12 | 13 | // ValidateResourceTypeConfigResponse returns the *tfprotov5.ValidateResourceTypeConfigResponse 14 | // equivalent of a *fwserver.ValidateResourceConfigResponse. 15 | func ValidateResourceTypeConfigResponse(ctx context.Context, fw *fwserver.ValidateResourceConfigResponse) *tfprotov5.ValidateResourceTypeConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto5 := &tfprotov5.ValidateResourceTypeConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto5 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto6/callfunction.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/function" 12 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 13 | ) 14 | 15 | // CallFunctionResponse returns the *tfprotov6.CallFunctionResponse 16 | // equivalent of a *fwserver.CallFunctionResponse. 17 | func CallFunctionResponse(ctx context.Context, fw *fwserver.CallFunctionResponse) *tfprotov6.CallFunctionResponse { 18 | if fw == nil { 19 | return nil 20 | } 21 | 22 | result, resultErr := FunctionResultData(ctx, fw.Result) 23 | 24 | funcErr := function.ConcatFuncErrors(fw.Error, resultErr) 25 | 26 | return &tfprotov6.CallFunctionResponse{ 27 | Error: FunctionError(ctx, funcErr), 28 | Result: result, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto6/closeephemeralresource.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // CloseEphemeralResourceResponse returns the *tfprotov6.CloseEphemeralResourceResponse 14 | // equivalent of a *fwserver.CloseEphemeralResourceResponse. 15 | func CloseEphemeralResourceResponse(ctx context.Context, fw *fwserver.CloseEphemeralResourceResponse) *tfprotov6.CloseEphemeralResourceResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.CloseEphemeralResourceResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto6 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto6/config.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata" 11 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 13 | ) 14 | 15 | // Config returns the *tfprotov6.DynamicValue for a *tfsdk.Config. 16 | func Config(ctx context.Context, fw *tfsdk.Config) (*tfprotov6.DynamicValue, diag.Diagnostics) { 17 | if fw == nil { 18 | return nil, nil 19 | } 20 | 21 | data := &fwschemadata.Data{ 22 | Description: fwschemadata.DataDescriptionConfiguration, 23 | Schema: fw.Schema, 24 | TerraformValue: fw.Raw, 25 | } 26 | 27 | return DynamicValue(ctx, data) 28 | } 29 | -------------------------------------------------------------------------------- /internal/toproto6/configureprovider.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/provider" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // ConfigureProviderResponse returns the *tfprotov6.ConfigureProviderResponse 14 | // equivalent of a *fwserver.ConfigureProviderResponse. 15 | func ConfigureProviderResponse(ctx context.Context, fw *provider.ConfigureResponse) *tfprotov6.ConfigureProviderResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.ConfigureProviderResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto6 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto6/datasourcemetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // DataSourceMetadata returns the tfprotov6.DataSourceMetadata for a 14 | // fwserver.DataSourceMetadata. 15 | func DataSourceMetadata(ctx context.Context, fw fwserver.DataSourceMetadata) tfprotov6.DataSourceMetadata { 16 | return tfprotov6.DataSourceMetadata{ 17 | TypeName: fw.TypeName, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /internal/toproto6/deferred.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/datasource" 10 | "github.com/hashicorp/terraform-plugin-framework/ephemeral" 11 | "github.com/hashicorp/terraform-plugin-framework/resource" 12 | ) 13 | 14 | func DataSourceDeferred(fw *datasource.Deferred) *tfprotov6.Deferred { 15 | if fw == nil { 16 | return nil 17 | } 18 | return &tfprotov6.Deferred{ 19 | Reason: tfprotov6.DeferredReason(fw.Reason), 20 | } 21 | } 22 | 23 | func ResourceDeferred(fw *resource.Deferred) *tfprotov6.Deferred { 24 | if fw == nil { 25 | return nil 26 | } 27 | return &tfprotov6.Deferred{ 28 | Reason: tfprotov6.DeferredReason(fw.Reason), 29 | } 30 | } 31 | 32 | func EphemeralResourceDeferred(fw *ephemeral.Deferred) *tfprotov6.Deferred { 33 | if fw == nil { 34 | return nil 35 | } 36 | return &tfprotov6.Deferred{ 37 | Reason: tfprotov6.DeferredReason(fw.Reason), 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /internal/toproto6/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package toproto6 contains functions to convert from framework types to 5 | // protocol version 6 (tfprotov6) types. 6 | package toproto6 7 | -------------------------------------------------------------------------------- /internal/toproto6/ephemeral_result_data.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata" 11 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 13 | ) 14 | 15 | // EphemeralResultData returns the *tfprotov6.DynamicValue for a *tfsdk.EphemeralResultData. 16 | func EphemeralResultData(ctx context.Context, fw *tfsdk.EphemeralResultData) (*tfprotov6.DynamicValue, diag.Diagnostics) { 17 | if fw == nil { 18 | return nil, nil 19 | } 20 | 21 | data := &fwschemadata.Data{ 22 | Description: fwschemadata.DataDescriptionEphemeralResultData, 23 | Schema: fw.Schema, 24 | TerraformValue: fw.Raw, 25 | } 26 | 27 | return DynamicValue(ctx, data) 28 | } 29 | -------------------------------------------------------------------------------- /internal/toproto6/ephemeralresourcemetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // EphemeralResourceMetadata returns the tfprotov6.EphemeralResourceMetadata for a 14 | // fwserver.EphemeralResourceMetadata. 15 | func EphemeralResourceMetadata(ctx context.Context, fw fwserver.EphemeralResourceMetadata) tfprotov6.EphemeralResourceMetadata { 16 | return tfprotov6.EphemeralResourceMetadata{ 17 | TypeName: fw.TypeName, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /internal/toproto6/function_errors.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/function" 12 | ) 13 | 14 | // FunctionError converts the function error into the tfprotov6 function error. 15 | func FunctionError(ctx context.Context, funcErr *function.FuncError) *tfprotov6.FunctionError { 16 | if funcErr == nil { 17 | return nil 18 | } 19 | 20 | return &tfprotov6.FunctionError{ 21 | Text: funcErr.Text, 22 | FunctionArgument: funcErr.FunctionArgument, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /internal/toproto6/getfunctions.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // GetFunctionsResponse returns the *tfprotov6.GetFunctionsResponse 14 | // equivalent of a *fwserver.GetFunctionsResponse. 15 | func GetFunctionsResponse(ctx context.Context, fw *fwserver.GetFunctionsResponse) *tfprotov6.GetFunctionsResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto := &tfprotov6.GetFunctionsResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | Functions: make(map[string]*tfprotov6.Function, len(fw.FunctionDefinitions)), 23 | } 24 | 25 | for name, functionDefinition := range fw.FunctionDefinitions { 26 | proto.Functions[name] = Function(ctx, functionDefinition) 27 | } 28 | 29 | return proto 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto6/pointer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6_test 5 | 6 | func pointer[T any](value T) *T { 7 | return &value 8 | } 9 | -------------------------------------------------------------------------------- /internal/toproto6/readdatasource.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 10 | 11 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 12 | ) 13 | 14 | // ReadDataSourceResponse returns the *tfprotov6.ReadDataSourceResponse 15 | // equivalent of a *fwserver.ReadDataSourceResponse. 16 | func ReadDataSourceResponse(ctx context.Context, fw *fwserver.ReadDataSourceResponse) *tfprotov6.ReadDataSourceResponse { 17 | if fw == nil { 18 | return nil 19 | } 20 | 21 | proto6 := &tfprotov6.ReadDataSourceResponse{ 22 | Deferred: DataSourceDeferred(fw.Deferred), 23 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 24 | } 25 | 26 | state, diags := State(ctx, fw.State) 27 | 28 | proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...) 29 | proto6.State = state 30 | 31 | return proto6 32 | } 33 | -------------------------------------------------------------------------------- /internal/toproto6/renewephemeralresource.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // RenewEphemeralResourceResponse returns the *tfprotov6.RenewEphemeralResourceResponse 14 | // equivalent of a *fwserver.RenewEphemeralResourceResponse. 15 | func RenewEphemeralResourceResponse(ctx context.Context, fw *fwserver.RenewEphemeralResourceResponse) *tfprotov6.RenewEphemeralResourceResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.RenewEphemeralResourceResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | RenewAt: fw.RenewAt, 23 | } 24 | 25 | newPrivate, diags := fw.Private.Bytes(ctx) 26 | 27 | proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...) 28 | proto6.Private = newPrivate 29 | 30 | return proto6 31 | } 32 | -------------------------------------------------------------------------------- /internal/toproto6/resourcemetadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // ResourceMetadata returns the tfprotov6.ResourceMetadata for a 14 | // fwserver.ResourceMetadata. 15 | func ResourceMetadata(ctx context.Context, fw fwserver.ResourceMetadata) tfprotov6.ResourceMetadata { 16 | return tfprotov6.ResourceMetadata{ 17 | TypeName: fw.TypeName, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /internal/toproto6/server_capabilities.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // ServerCapabilities returns the *tfprotov6.ServerCapabilities for a 14 | // *fwserver.ServerCapabilities. 15 | func ServerCapabilities(ctx context.Context, fw *fwserver.ServerCapabilities) *tfprotov6.ServerCapabilities { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | return &tfprotov6.ServerCapabilities{ 21 | GetProviderSchemaOptional: fw.GetProviderSchemaOptional, 22 | MoveResourceState: fw.MoveResourceState, 23 | PlanDestroy: fw.PlanDestroy, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto6/state.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata" 11 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 12 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 13 | ) 14 | 15 | // State returns the *tfprotov6.DynamicValue for a *tfsdk.State. 16 | func State(ctx context.Context, fw *tfsdk.State) (*tfprotov6.DynamicValue, diag.Diagnostics) { 17 | if fw == nil { 18 | return nil, nil 19 | } 20 | 21 | data := &fwschemadata.Data{ 22 | Description: fwschemadata.DataDescriptionState, 23 | Schema: fw.Schema, 24 | TerraformValue: fw.Raw, 25 | } 26 | 27 | return DynamicValue(ctx, data) 28 | } 29 | -------------------------------------------------------------------------------- /internal/toproto6/upgraderesourceidentity.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // UpgradeResourceIdentityResponse returns the *tfprotov6.UpgradeResourceIdentityResponse 14 | // equivalent of a *fwserver.UpgradeResourceIdentityResponse. 15 | func UpgradeResourceIdentityResponse(ctx context.Context, fw *fwserver.UpgradeResourceIdentityResponse) *tfprotov6.UpgradeResourceIdentityResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.UpgradeResourceIdentityResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | upgradedIdentity, diags := ResourceIdentity(ctx, fw.UpgradedIdentity) 25 | 26 | proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...) 27 | proto6.UpgradedIdentity = upgradedIdentity 28 | 29 | return proto6 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto6/upgraderesourcestate.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // UpgradeResourceStateResponse returns the *tfprotov6.UpgradeResourceStateResponse 14 | // equivalent of a *fwserver.UpgradeResourceStateResponse. 15 | func UpgradeResourceStateResponse(ctx context.Context, fw *fwserver.UpgradeResourceStateResponse) *tfprotov6.UpgradeResourceStateResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.UpgradeResourceStateResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | upgradedState, diags := State(ctx, fw.UpgradedState) 25 | 26 | proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...) 27 | proto6.UpgradedState = upgradedState 28 | 29 | return proto6 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto6/validatedatasourceconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // ValidateDataSourceConfigResponse returns the *tfprotov6.ValidateDataSourceConfigResponse 14 | // equivalent of a *fwserver.ValidateDataSourceConfigResponse. 15 | func ValidateDataSourceConfigResponse(ctx context.Context, fw *fwserver.ValidateDataSourceConfigResponse) *tfprotov6.ValidateDataResourceConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.ValidateDataResourceConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto6 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto6/validateephemeralresourceconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // ValidateEphemeralResourceConfigResponse returns the *tfprotov6.ValidateEphemeralResourceConfigResponse 14 | // equivalent of a *fwserver.ValidateEphemeralResourceConfigResponse. 15 | func ValidateEphemeralResourceConfigResponse(ctx context.Context, fw *fwserver.ValidateEphemeralResourceConfigResponse) *tfprotov6.ValidateEphemeralResourceConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.ValidateEphemeralResourceConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto6 25 | } 26 | -------------------------------------------------------------------------------- /internal/toproto6/validateproviderconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // ValidateProviderConfigResponse returns the *tfprotov6.ValidateProviderConfigResponse 14 | // equivalent of a *fwserver.ValidateProviderConfigResponse. 15 | func ValidateProviderConfigResponse(ctx context.Context, fw *fwserver.ValidateProviderConfigResponse) *tfprotov6.ValidateProviderConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.ValidateProviderConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | preparedConfig, diags := Config(ctx, fw.PreparedConfig) 25 | 26 | proto6.Diagnostics = append(proto6.Diagnostics, Diagnostics(ctx, diags)...) 27 | proto6.PreparedConfig = preparedConfig 28 | 29 | return proto6 30 | } 31 | -------------------------------------------------------------------------------- /internal/toproto6/validateresourceconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package toproto6 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/internal/fwserver" 10 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" 11 | ) 12 | 13 | // ValidateResourceConfigResponse returns the *tfprotov6.ValidateResourceConfigResponse 14 | // equivalent of a *fwserver.ValidateResourceConfigResponse. 15 | func ValidateResourceConfigResponse(ctx context.Context, fw *fwserver.ValidateResourceConfigResponse) *tfprotov6.ValidateResourceConfigResponse { 16 | if fw == nil { 17 | return nil 18 | } 19 | 20 | proto6 := &tfprotov6.ValidateResourceConfigResponse{ 21 | Diagnostics: Diagnostics(ctx, fw.Diagnostics), 22 | } 23 | 24 | return proto6 25 | } 26 | -------------------------------------------------------------------------------- /internal/totftypes/attribute_paths.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package totftypes 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/path" 11 | "github.com/hashicorp/terraform-plugin-go/tftypes" 12 | ) 13 | 14 | // AttributePaths returns the []*tftypes.AttributePath equivalent of a path.Paths. 15 | func AttributePaths(ctx context.Context, fw path.Paths) ([]*tftypes.AttributePath, diag.Diagnostics) { 16 | if fw == nil { 17 | return nil, nil 18 | } 19 | 20 | result := make([]*tftypes.AttributePath, 0, len(fw)) 21 | 22 | for _, path := range fw { 23 | tfType, diags := AttributePath(ctx, path) 24 | 25 | if diags.HasError() { 26 | return result, diags 27 | } 28 | 29 | result = append(result, tfType) 30 | } 31 | 32 | return result, nil 33 | } 34 | -------------------------------------------------------------------------------- /internal/totftypes/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package totftypes contains functions to convert from framework types to 5 | // terraform-plugin-go tftypes types. 6 | package totftypes 7 | -------------------------------------------------------------------------------- /list/config_validator.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package list 5 | 6 | import "context" 7 | 8 | // ConfigValidator describes reusable ListResource configuration validation 9 | // functionality. 10 | type ConfigValidator interface { 11 | // Description describes the validation in plain text formatting. 12 | // 13 | // This information may be automatically added to list resource plain text 14 | // descriptions by external tooling. 15 | Description(context.Context) string 16 | 17 | // MarkdownDescription describes the validation in Markdown formatting. 18 | // 19 | // This information may be automatically added to list resource Markdown 20 | // descriptions by external tooling. 21 | MarkdownDescription(context.Context) string 22 | 23 | // ValidateResource performs the validation. 24 | // 25 | // This method name is separate from ConfigValidators in resource and other packages in 26 | // order to allow generic validators. 27 | ValidateListResourceConfig(context.Context, ValidateConfigRequest, *ValidateConfigResponse) 28 | } 29 | -------------------------------------------------------------------------------- /list/no_op_list_resource_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package list_test 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/list" 10 | ) 11 | 12 | type NoOpListResource struct{} 13 | 14 | func (*NoOpListResource) ListResourceConfigSchema(_ context.Context, _ list.ListResourceSchemaRequest, _ *list.ListResourceSchemaResponse) { 15 | } 16 | 17 | func (*NoOpListResource) List(_ context.Context, _ list.ListRequest, _ *list.ListResultsStream) { 18 | } 19 | -------------------------------------------------------------------------------- /list/no_op_resource_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package list_test 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/resource" 10 | ) 11 | 12 | type NoOpResource struct{} 13 | 14 | func (*NoOpResource) Schema(_ context.Context, _ resource.SchemaRequest, _ *resource.SchemaResponse) { 15 | } 16 | 17 | func (*NoOpResource) Create(_ context.Context, _ resource.CreateRequest, _ *resource.CreateResponse) { 18 | } 19 | 20 | func (*NoOpResource) Read(_ context.Context, _ resource.ReadRequest, _ *resource.ReadResponse) { 21 | } 22 | 23 | func (*NoOpResource) Update(_ context.Context, _ resource.UpdateRequest, _ *resource.UpdateResponse) { 24 | } 25 | 26 | func (*NoOpResource) Delete(_ context.Context, _ resource.DeleteRequest, _ *resource.DeleteResponse) { 27 | } 28 | -------------------------------------------------------------------------------- /list/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package list 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/list/schema" 9 | ) 10 | 11 | // ListResourceSchemaRequest represents a request for the ListResource to 12 | // return its schema. An instance of this request struct is supplied as an 13 | // argument to the ListResource type ListResourceSchema method. 14 | type ListResourceSchemaRequest struct{} 15 | 16 | // ListResourceSchemaResponse represents a response to a 17 | // ListResourceSchemaRequest. An instance of this response struct is supplied 18 | // as an argument to the ListResource type ListResourceResourceSchema method. 19 | type ListResourceSchemaResponse struct { 20 | // Schema is the schema of the list resource. 21 | Schema schema.Schema 22 | 23 | // Diagnostics report errors or warnings related to retrieving the list 24 | // resource schema. An empty slice indicates success, with no warnings 25 | // or errors generated. 26 | Diagnostics diag.Diagnostics 27 | } 28 | -------------------------------------------------------------------------------- /list/schema/attribute.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package schema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Attribute define a value field inside the Schema. Implementations in this 11 | // package include: 12 | // - StringAttribute 13 | // 14 | // In practitioner configurations, an equals sign (=) is required to set 15 | // the value. [Configuration Reference] 16 | // 17 | // [Configuration Reference]: https://developer.hashicorp.com/terraform/language/syntax/configuration 18 | type Attribute interface { 19 | fwschema.Attribute 20 | } 21 | -------------------------------------------------------------------------------- /list/schema/block.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package schema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Block defines a structural field inside a Schema. Implementations in this 11 | // package include: 12 | // 13 | // In practitioner configurations, an equals sign (=) cannot be used to set the 14 | // value. Blocks are instead repeated as necessary, or require the use of 15 | // [Dynamic Block Expressions]. 16 | // 17 | // Prefer NestedAttribute over Block. Blocks should typically be used for 18 | // configuration compatibility with previously existing schemas from an older 19 | // Terraform Plugin SDK. Efforts should be made to convert from Block to 20 | // NestedAttribute as a breaking change for practitioners. 21 | // 22 | // [Dynamic Block Expressions]: https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks 23 | // 24 | // [Configuration Reference]: https://developer.hashicorp.com/terraform/language/syntax/configuration 25 | type Block interface { 26 | fwschema.Block 27 | } 28 | -------------------------------------------------------------------------------- /list/schema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package schema contains all available schema functionality for list 5 | // resources. List resource schemas define the structure of a list block. 6 | // Schemas are implemented via the list.ListResource type Schema method. 7 | package schema 8 | -------------------------------------------------------------------------------- /path/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package path implements attribute path functionality, which defines 5 | // transversals into schema-based data. 6 | package path 7 | -------------------------------------------------------------------------------- /path/expression_step.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package path 5 | 6 | // ExpressionStep represents an expression of an attribute path step, which may 7 | // match zero, one, or more actual paths. 8 | type ExpressionStep interface { 9 | // Equal should return true if the given Step is exactly equivalent. 10 | Equal(ExpressionStep) bool 11 | 12 | // Matches should return true if the given PathStep can be fulfilled by the 13 | // ExpressionStep. 14 | Matches(PathStep) bool 15 | 16 | // String should return a human-readable representation of the step 17 | // intended for logging and error messages. There should not be usage 18 | // that needs to be protected by compatibility guarantees. 19 | String() string 20 | 21 | // unexported prevents outside types from satisfying the interface. 22 | unexported() 23 | } 24 | -------------------------------------------------------------------------------- /path/path_step.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package path 5 | 6 | // PathStep represents a transversal for an attribute path. Only exact path 7 | // transversals are supported as implementations of this interface must remain 8 | // compatible with all protocol implementations. 9 | type PathStep interface { 10 | // Equal should return true if the given PathStep is exactly equivalent. 11 | Equal(PathStep) bool 12 | 13 | // ExpressionStep should return an ExpressionStep which exactly 14 | // matches the PathStep. 15 | ExpressionStep() ExpressionStep 16 | 17 | // String should return a human-readable representation of the step 18 | // intended for logging and error messages. There should not be usage 19 | // that needs to be protected by compatibility guarantees. 20 | String() string 21 | 22 | // unexported prevents outside types from satisfying the interface. 23 | unexported() 24 | } 25 | -------------------------------------------------------------------------------- /provider/metadata.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package provider 5 | 6 | // MetadataRequest represents a request for the Provider to return its type 7 | // name. An instance of this request struct is supplied as an argument to the 8 | // Provider type Metadata method. 9 | type MetadataRequest struct{} 10 | 11 | // MetadataResponse represents a response to a MetadataRequest. An 12 | // instance of this response struct is supplied as an argument to the 13 | // Provider type Metadata method. 14 | type MetadataResponse struct { 15 | // TypeName should be the provider type. For example, examplecloud, if 16 | // the intended resource or data source types are examplecloud_thing, etc. 17 | TypeName string 18 | 19 | // Version should be the provider version, such as 1.2.3. 20 | // 21 | // This is not connected to any framework functionality currently, but may 22 | // be in the future. 23 | Version string 24 | } 25 | -------------------------------------------------------------------------------- /provider/metaschema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package provider 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/provider/metaschema" 9 | ) 10 | 11 | // MetaSchemaRequest represents a request for the Provider to return its schema. 12 | // An instance of this request struct is supplied as an argument to the 13 | // Provider type Schema method. 14 | type MetaSchemaRequest struct{} 15 | 16 | // MetaSchemaResponse represents a response to a MetaSchemaRequest. An instance of this 17 | // response struct is supplied as an argument to the Provider type Schema 18 | // method. 19 | type MetaSchemaResponse struct { 20 | // Schema is the meta schema of the provider. 21 | Schema metaschema.Schema 22 | 23 | // Diagnostics report errors or warnings related to validating the data 24 | // source configuration. An empty slice indicates success, with no warnings 25 | // or errors generated. 26 | Diagnostics diag.Diagnostics 27 | } 28 | -------------------------------------------------------------------------------- /provider/metaschema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package metaschema contains all available meta schema functionality for 5 | // providers. Provider meta schemas define the structure and value types for 6 | // provider_meta configuration data. Meta schemas are implemented via the 7 | // provider.ProviderWithMetaSchema type MetaSchema method. 8 | package metaschema 9 | -------------------------------------------------------------------------------- /provider/metaschema/nested_attribute.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package metaschema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Nested attributes are only compatible with protocol version 6. 11 | type NestedAttribute interface { 12 | Attribute 13 | fwschema.NestedAttribute 14 | } 15 | -------------------------------------------------------------------------------- /provider/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package provider 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/provider/schema" 9 | ) 10 | 11 | // SchemaRequest represents a request for the Provider to return its schema. 12 | // An instance of this request struct is supplied as an argument to the 13 | // Provider type Schema method. 14 | type SchemaRequest struct{} 15 | 16 | // SchemaResponse represents a response to a SchemaRequest. An instance of this 17 | // response struct is supplied as an argument to the Provider type Schema 18 | // method. 19 | type SchemaResponse struct { 20 | // Schema is the schema of the provider. 21 | Schema schema.Schema 22 | 23 | // Diagnostics report errors or warnings related to validating the data 24 | // source configuration. An empty slice indicates success, with no warnings 25 | // or errors generated. 26 | Diagnostics diag.Diagnostics 27 | } 28 | -------------------------------------------------------------------------------- /provider/schema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package schema contains all available schema functionality for data sources. 5 | // Data source schemas define the structure and value types for configuration 6 | // and state data. Schemas are implemented via the datasource.DataSource type 7 | // Schema method. 8 | package schema 9 | -------------------------------------------------------------------------------- /provider/schema/nested_attribute.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package schema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Nested attributes are only compatible with protocol version 6. 11 | type NestedAttribute interface { 12 | Attribute 13 | fwschema.NestedAttribute 14 | } 15 | -------------------------------------------------------------------------------- /providerserver/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package providerserver implements functionality for serving a provider, 5 | // such as directly starting a server in a production binary and conversion 6 | // functions for testing. 7 | // 8 | // For production usage, call the Serve function from binary startup, such as 9 | // from the provider codebase main package. If multiplexing the provider server 10 | // via terraform-plugin-mux functionality, use the NewProtocol* functions and 11 | // call the Serve function from that Go module. For testing usage, call the 12 | // NewProtocol* functions. 13 | // 14 | // All functionality in this package requires the provider.Provider type, which 15 | // contains the provider implementation including all managed resources and 16 | // data sources. 17 | package providerserver 18 | -------------------------------------------------------------------------------- /resource/identity_schema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package resource 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/resource/identityschema" 9 | ) 10 | 11 | // IdentitySchemaRequest represents a request for the Resource to return its identity schema. 12 | // An instance of this request struct is supplied as an argument to the 13 | // Resource type IdentitySchema method. 14 | type IdentitySchemaRequest struct{} 15 | 16 | // IdentitySchemaResponse represents a response to a SchemaRequest. An instance of this 17 | // response struct is supplied as an argument to the Resource type IdentitySchema 18 | // method. 19 | type IdentitySchemaResponse struct { 20 | // IdentitySchema is the schema of the resource identity. 21 | IdentitySchema identityschema.Schema 22 | 23 | // Diagnostics report errors or warnings related to retrieving the resource 24 | // identity schema. An empty slice indicates success, with no warnings 25 | // or errors generated. 26 | Diagnostics diag.Diagnostics 27 | } 28 | -------------------------------------------------------------------------------- /resource/identityschema/attribute.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package identityschema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Attribute define a value field inside the Schema. Implementations in this 11 | // package include: 12 | // - BoolAttribute 13 | // - Float32Attribute 14 | // - Float64Attribute 15 | // - Int32Attribute 16 | // - Int64Attribute 17 | // - ListAttribute 18 | // - NumberAttribute 19 | // - StringAttribute 20 | // 21 | // The available attribute types for a resource identity schema are intentionally 22 | // limited. Nested attributes and blocks are not supported in identity schemas, 23 | // as well as ListAttribute definitions can only have primitive element types of: 24 | // - types.BoolType 25 | // - types.Float32Type 26 | // - types.Float64Type 27 | // - types.Int32Type 28 | // - types.Int64Type 29 | // - types.NumberType 30 | // - types.StringType 31 | type Attribute interface { 32 | fwschema.Attribute 33 | } 34 | -------------------------------------------------------------------------------- /resource/identityschema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package identityschema contains all available schema functionality for managed 5 | // resource identity. 6 | // 7 | // Resource identity schemas define the structure and value types for identity state data. 8 | // Schemas are implemented via the resource.ResourceWithIdentity type IdentitySchema method. 9 | package identityschema 10 | -------------------------------------------------------------------------------- /resource/schema.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package resource 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/resource/schema" 9 | ) 10 | 11 | // SchemaRequest represents a request for the Resource to return its schema. 12 | // An instance of this request struct is supplied as an argument to the 13 | // Resource type Schema method. 14 | type SchemaRequest struct{} 15 | 16 | // SchemaResponse represents a response to a SchemaRequest. An instance of this 17 | // response struct is supplied as an argument to the Resource type Schema 18 | // method. 19 | type SchemaResponse struct { 20 | // Schema is the schema of the data source. 21 | Schema schema.Schema 22 | 23 | // Diagnostics report errors or warnings related to validating the data 24 | // source configuration. An empty slice indicates success, with no warnings 25 | // or errors generated. 26 | Diagnostics diag.Diagnostics 27 | } 28 | -------------------------------------------------------------------------------- /resource/schema/booldefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package booldefault provides default values for types.Bool attributes. 5 | package booldefault 6 | -------------------------------------------------------------------------------- /resource/schema/boolplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package boolplanmodifier provides plan modifiers for types.Bool attributes. 5 | package boolplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/boolplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package boolplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.BoolRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/defaults/map.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package defaults 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/path" 11 | "github.com/hashicorp/terraform-plugin-framework/types" 12 | ) 13 | 14 | // Map is a schema default value for types.Map attributes. 15 | type Map interface { 16 | Describer 17 | 18 | // DefaultMap should set the default value. 19 | DefaultMap(context.Context, MapRequest, *MapResponse) 20 | } 21 | 22 | type MapRequest struct { 23 | // Path contains the path of the attribute for setting the 24 | // default value. Use this path for any response diagnostics. 25 | Path path.Path 26 | } 27 | 28 | type MapResponse struct { 29 | // Diagnostics report errors or warnings related to setting the 30 | // default value resource configuration. An empty slice 31 | // indicates success, with no warnings or errors generated. 32 | Diagnostics diag.Diagnostics 33 | 34 | // PlanValue is the planned new state for the attribute. 35 | PlanValue types.Map 36 | } 37 | -------------------------------------------------------------------------------- /resource/schema/defaults/set.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package defaults 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/path" 11 | "github.com/hashicorp/terraform-plugin-framework/types" 12 | ) 13 | 14 | // Set is a schema default value for types.Set attributes. 15 | type Set interface { 16 | Describer 17 | 18 | // DefaultSet should set the default value. 19 | DefaultSet(context.Context, SetRequest, *SetResponse) 20 | } 21 | 22 | type SetRequest struct { 23 | // Path contains the path of the attribute for setting the 24 | // default value. Use this path for any response diagnostics. 25 | Path path.Path 26 | } 27 | 28 | type SetResponse struct { 29 | // Diagnostics report errors or warnings related to setting the 30 | // default value resource configuration. An empty slice 31 | // indicates success, with no warnings or errors generated. 32 | Diagnostics diag.Diagnostics 33 | 34 | // PlanValue is the planned new state for the attribute. 35 | PlanValue types.Set 36 | } 37 | -------------------------------------------------------------------------------- /resource/schema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package schema contains all available schema functionality for resources. 5 | // Resource schemas define the structure and value types for configuration, 6 | // plan, and state data. Schemas are implemented via the resource.Resource type 7 | // Schema method. 8 | package schema 9 | -------------------------------------------------------------------------------- /resource/schema/dynamicdefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package dynamicdefault provides default values for types.Dynamic attributes. 5 | package dynamicdefault 6 | -------------------------------------------------------------------------------- /resource/schema/dynamicplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package dynamicplanmodifier provides plan modifiers for types.Dynamic attributes. 5 | package dynamicplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/dynamicplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package dynamicplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.DynamicRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/float32default/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package float32default provides default values for types.Float32 attributes. 5 | package float32default 6 | -------------------------------------------------------------------------------- /resource/schema/float32planmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package float32planmodifier provides plan modifiers for types.Float32 attributes. 5 | package float32planmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/float32planmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package float32planmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.Float32Request, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/float64default/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package float64default provides default values for types.Float64 attributes. 5 | package float64default 6 | -------------------------------------------------------------------------------- /resource/schema/float64planmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package float64planmodifier provides plan modifiers for types.Float64 attributes. 5 | package float64planmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/float64planmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package float64planmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.Float64Request, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/int32default/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package int32default provides default values for types.Int32 attributes. 5 | package int32default 6 | -------------------------------------------------------------------------------- /resource/schema/int32planmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package int32planmodifier provides plan modifiers for types.Int32 attributes. 5 | package int32planmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/int32planmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package int32planmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.Int32Request, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/int64default/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package int64default provides default values for types.Int64 attributes. 5 | package int64default 6 | -------------------------------------------------------------------------------- /resource/schema/int64planmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package int64planmodifier provides plan modifiers for types.Int64 attributes. 5 | package int64planmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/int64planmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package int64planmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.Int64Request, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/listdefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package listdefault provides default values for types.List attributes. 5 | package listdefault 6 | -------------------------------------------------------------------------------- /resource/schema/listplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package listplanmodifier provides plan modifiers for types.List attributes. 5 | package listplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/listplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package listplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.ListRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/mapdefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package mapdefault provides default values for types.Map attributes. 5 | package mapdefault 6 | -------------------------------------------------------------------------------- /resource/schema/mapplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package mapplanmodifier provides plan modifiers for types.Map attributes. 5 | package mapplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/mapplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package mapplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.MapRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/nested_attribute.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package schema 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" 8 | ) 9 | 10 | // Nested attributes are only compatible with protocol version 6. 11 | type NestedAttribute interface { 12 | Attribute 13 | fwschema.NestedAttribute 14 | } 15 | -------------------------------------------------------------------------------- /resource/schema/numberdefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package numberdefault provides default values for types.Number attributes. 5 | package numberdefault 6 | -------------------------------------------------------------------------------- /resource/schema/numberplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package numberplanmodifier provides plan modifiers for types.Number attributes. 5 | package numberplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/numberplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package numberplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.NumberRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/objectdefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package objectdefault provides default values for types.Object attributes. 5 | package objectdefault 6 | -------------------------------------------------------------------------------- /resource/schema/objectplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package objectplanmodifier provides plan modifiers for types.Object attributes. 5 | package objectplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/objectplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package objectplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.ObjectRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/setdefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package setdefault provides default values for types.Set attributes. 5 | package setdefault 6 | -------------------------------------------------------------------------------- /resource/schema/setplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package setplanmodifier provides plan modifiers for types.Set attributes. 5 | package setplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/setplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package setplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.SetRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /resource/schema/stringdefault/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package stringdefault provides default values for types.String attributes. 5 | package stringdefault 6 | -------------------------------------------------------------------------------- /resource/schema/stringplanmodifier/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package stringplanmodifier provides plan modifiers for types.String attributes. 5 | package stringplanmodifier 6 | -------------------------------------------------------------------------------- /resource/schema/stringplanmodifier/requires_replace_if_func.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package stringplanmodifier 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/diag" 10 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" 11 | ) 12 | 13 | // RequiresReplaceIfFunc is a conditional function used in the RequiresReplaceIf 14 | // plan modifier to determine whether the attribute requires replacement. 15 | type RequiresReplaceIfFunc func(context.Context, planmodifier.StringRequest, *RequiresReplaceIfFuncResponse) 16 | 17 | // RequiresReplaceIfFuncResponse is the response type for a RequiresReplaceIfFunc. 18 | type RequiresReplaceIfFuncResponse struct { 19 | // Diagnostics report errors or warnings related to this logic. An empty 20 | // or unset slice indicates success, with no warnings or errors generated. 21 | Diagnostics diag.Diagnostics 22 | 23 | // RequiresReplace should be enabled if the resource should be replaced. 24 | RequiresReplace bool 25 | } 26 | -------------------------------------------------------------------------------- /schema/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package schema contains functionality common to all schemas. Refer to the 5 | // datasource/schema, provider/schema, and resource/schema packages for concept 6 | // specific implementations. 7 | package schema 8 | -------------------------------------------------------------------------------- /schema/validator/client_capabilities.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package validator 5 | 6 | // ValidateSchemaClientCapabilities allows Terraform to publish information 7 | // regarding optionally supported protocol features for the schema validation 8 | // RPCs, such as forward-compatible Terraform behavior changes. 9 | type ValidateSchemaClientCapabilities struct { 10 | // WriteOnlyAttributesAllowed indicates that the Terraform client 11 | // initiating the request supports write-only attributes for managed 12 | // resources. 13 | // 14 | // This client capability is only populated during managed resource schema 15 | // validation. 16 | WriteOnlyAttributesAllowed bool 17 | } 18 | -------------------------------------------------------------------------------- /tfsdk/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package tfsdk contains core framework functionality for schema data. 5 | package tfsdk 6 | -------------------------------------------------------------------------------- /tfsdk/pointer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package tfsdk_test 5 | 6 | func pointer[T any](value T) *T { 7 | return &value 8 | } 9 | -------------------------------------------------------------------------------- /tfsdk/value_from.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package tfsdk 5 | 6 | import ( 7 | "context" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/attr" 10 | "github.com/hashicorp/terraform-plugin-framework/diag" 11 | "github.com/hashicorp/terraform-plugin-framework/internal/reflect" 12 | "github.com/hashicorp/terraform-plugin-framework/path" 13 | ) 14 | 15 | // ValueFrom takes the Go value `val` and populates `target` with an attr.Value, 16 | // based on the type definition provided in `targetType`. 17 | // 18 | // This is achieved using reflection rules provided by the internal/reflect package. 19 | func ValueFrom(ctx context.Context, val interface{}, targetType attr.Type, target interface{}) diag.Diagnostics { 20 | v, diags := reflect.FromValue(ctx, targetType, val, path.Empty()) 21 | if diags.HasError() { 22 | return diags 23 | } 24 | 25 | return ValueAs(ctx, v, target) 26 | } 27 | -------------------------------------------------------------------------------- /tools/copywrite.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | //go:build generate 5 | 6 | package tools 7 | 8 | import ( 9 | // copywrite header generation 10 | _ "github.com/hashicorp/copywrite" 11 | ) 12 | 13 | //go:generate go run github.com/hashicorp/copywrite headers -d .. --config ../.copywrite.hcl 14 | -------------------------------------------------------------------------------- /types/basetypes/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package basetypes contains the implementations for framework-defined data 5 | // types and values, such as boolean, floating point, integer, list, map, 6 | // object, set, and string. Embed these implementations to create custom types. 7 | package basetypes 8 | -------------------------------------------------------------------------------- /types/basetypes/pointer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package basetypes 5 | 6 | func pointer[T any](value T) *T { 7 | return &value 8 | } 9 | -------------------------------------------------------------------------------- /types/bool_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var BoolType = basetypes.BoolType{} 9 | -------------------------------------------------------------------------------- /types/bool_value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type Bool = basetypes.BoolValue 9 | 10 | // BoolNull creates a Bool with a null value. Determine whether the value is 11 | // null via the Bool type IsNull method. 12 | func BoolNull() basetypes.BoolValue { 13 | return basetypes.NewBoolNull() 14 | } 15 | 16 | // BoolUnknown creates a Bool with an unknown value. Determine whether the 17 | // value is unknown via the Bool type IsUnknown method. 18 | func BoolUnknown() basetypes.BoolValue { 19 | return basetypes.NewBoolUnknown() 20 | } 21 | 22 | // BoolValue creates a Bool with a known value. Access the value via the Bool 23 | // type ValueBool method. 24 | func BoolValue(value bool) basetypes.BoolValue { 25 | return basetypes.NewBoolValue(value) 26 | } 27 | 28 | // BoolPointerValue creates a Bool with a null value if nil or a known value. 29 | func BoolPointerValue(value *bool) basetypes.BoolValue { 30 | return basetypes.NewBoolPointerValue(value) 31 | } 32 | -------------------------------------------------------------------------------- /types/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | // Package types contains the framework-defined data types and values, such as 5 | // boolean, floating point, integer, list, map, object, set, and string. 6 | // 7 | // This package contains creation functions and type aliases for most provider 8 | // use cases. The actual schema-ready type and value type implementations are 9 | // under the basetypes package. Embed those basetypes implementations to create 10 | // custom types. 11 | package types 12 | -------------------------------------------------------------------------------- /types/dynamic_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var DynamicType = basetypes.DynamicType{} 9 | -------------------------------------------------------------------------------- /types/dynamic_value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import ( 7 | "github.com/hashicorp/terraform-plugin-framework/attr" 8 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 9 | ) 10 | 11 | type Dynamic = basetypes.DynamicValue 12 | 13 | // DynamicNull creates a Dynamic with a null value. Determine whether the value is 14 | // null via the Dynamic type IsNull method. 15 | func DynamicNull() basetypes.DynamicValue { 16 | return basetypes.NewDynamicNull() 17 | } 18 | 19 | // DynamicUnknown creates a Dynamic with an unknown value. Determine whether the 20 | // value is unknown via the Dynamic type IsUnknown method. 21 | func DynamicUnknown() basetypes.DynamicValue { 22 | return basetypes.NewDynamicUnknown() 23 | } 24 | 25 | // DynamicValue creates a Dynamic with a known value. Access the value via the Dynamic 26 | // type UnderlyingValue method. 27 | func DynamicValue(value attr.Value) basetypes.DynamicValue { 28 | return basetypes.NewDynamicValue(value) 29 | } 30 | -------------------------------------------------------------------------------- /types/float32_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var Float32Type = basetypes.Float32Type{} 9 | -------------------------------------------------------------------------------- /types/float64_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var Float64Type = basetypes.Float64Type{} 9 | -------------------------------------------------------------------------------- /types/int32_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var Int32Type = basetypes.Int32Type{} 9 | -------------------------------------------------------------------------------- /types/int32_value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type Int32 = basetypes.Int32Value 9 | 10 | // Int32Null creates a Int32 with a null value. Determine whether the value is 11 | // null via the Int32 type IsNull method. 12 | func Int32Null() basetypes.Int32Value { 13 | return basetypes.NewInt32Null() 14 | } 15 | 16 | // Int32Unknown creates a Int32 with an unknown value. Determine whether the 17 | // value is unknown via the Int32 type IsUnknown method. 18 | func Int32Unknown() basetypes.Int32Value { 19 | return basetypes.NewInt32Unknown() 20 | } 21 | 22 | // Int32Value creates a Int32 with a known value. Access the value via the 23 | // Int32 type ValueInt32 method. 24 | func Int32Value(value int32) basetypes.Int32Value { 25 | return basetypes.NewInt32Value(value) 26 | } 27 | 28 | // Int32PointerValue creates a Int32 with a null value if nil or a known value. 29 | func Int32PointerValue(value *int32) basetypes.Int32Value { 30 | return basetypes.NewInt32PointerValue(value) 31 | } 32 | -------------------------------------------------------------------------------- /types/int64_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var Int64Type = basetypes.Int64Type{} 9 | -------------------------------------------------------------------------------- /types/int64_value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type Int64 = basetypes.Int64Value 9 | 10 | // Int64Null creates a Int64 with a null value. Determine whether the value is 11 | // null via the Int64 type IsNull method. 12 | func Int64Null() basetypes.Int64Value { 13 | return basetypes.NewInt64Null() 14 | } 15 | 16 | // Int64Unknown creates a Int64 with an unknown value. Determine whether the 17 | // value is unknown via the Int64 type IsUnknown method. 18 | func Int64Unknown() basetypes.Int64Value { 19 | return basetypes.NewInt64Unknown() 20 | } 21 | 22 | // Int64Value creates a Int64 with a known value. Access the value via the 23 | // Int64 type ValueInt64 method. 24 | func Int64Value(value int64) basetypes.Int64Value { 25 | return basetypes.NewInt64Value(value) 26 | } 27 | 28 | // Int64PointerValue creates a Int64 with a null value if nil or a known value. 29 | func Int64PointerValue(value *int64) basetypes.Int64Value { 30 | return basetypes.NewInt64PointerValue(value) 31 | } 32 | -------------------------------------------------------------------------------- /types/list_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type ListType = basetypes.ListType 9 | -------------------------------------------------------------------------------- /types/map_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type MapType = basetypes.MapType 9 | -------------------------------------------------------------------------------- /types/number_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var NumberType = basetypes.NumberType{} 9 | -------------------------------------------------------------------------------- /types/number_value.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import ( 7 | "math/big" 8 | 9 | "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 10 | ) 11 | 12 | type Number = basetypes.NumberValue 13 | 14 | // NumberNull creates a Number with a null value. Determine whether the value is 15 | // null via the Number type IsNull method. 16 | func NumberNull() basetypes.NumberValue { 17 | return basetypes.NewNumberNull() 18 | } 19 | 20 | // NumberUnknown creates a Number with an unknown value. Determine whether the 21 | // value is unknown via the Number type IsUnknown method. 22 | func NumberUnknown() basetypes.NumberValue { 23 | return basetypes.NewNumberUnknown() 24 | } 25 | 26 | // NumberValue creates a Number with a known value. Access the value via the Number 27 | // type ValueBigFloat method. If the given value is nil, a null Number is created. 28 | func NumberValue(value *big.Float) basetypes.NumberValue { 29 | return basetypes.NewNumberValue(value) 30 | } 31 | -------------------------------------------------------------------------------- /types/object_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type ObjectType = basetypes.ObjectType 9 | -------------------------------------------------------------------------------- /types/set_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type SetType = basetypes.SetType 9 | -------------------------------------------------------------------------------- /types/string_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | var StringType = basetypes.StringType{} 9 | -------------------------------------------------------------------------------- /types/tuple_type.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: MPL-2.0 3 | 4 | package types 5 | 6 | import "github.com/hashicorp/terraform-plugin-framework/types/basetypes" 7 | 8 | type TupleType = basetypes.TupleType 9 | -------------------------------------------------------------------------------- /website/img/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/.gitkeep -------------------------------------------------------------------------------- /website/img/apply-resource-change-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/apply-resource-change-detail.png -------------------------------------------------------------------------------- /website/img/apply-resource-change-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/apply-resource-change-overview.png -------------------------------------------------------------------------------- /website/img/configure-provider-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/configure-provider-detail.png -------------------------------------------------------------------------------- /website/img/configure-provider-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/configure-provider-overview.png -------------------------------------------------------------------------------- /website/img/get-provider-schema-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/get-provider-schema-detail.png -------------------------------------------------------------------------------- /website/img/get-provider-schema-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/get-provider-schema-overview.png -------------------------------------------------------------------------------- /website/img/plan-resource-change-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/plan-resource-change-detail.png -------------------------------------------------------------------------------- /website/img/plan-resource-change-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/plan-resource-change-overview.png -------------------------------------------------------------------------------- /website/img/read-data-source-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/read-data-source-detail.png -------------------------------------------------------------------------------- /website/img/read-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/read-overview.png -------------------------------------------------------------------------------- /website/img/read-resource-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/read-resource-detail.png -------------------------------------------------------------------------------- /website/img/validate-config-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/validate-config-overview.png -------------------------------------------------------------------------------- /website/img/validate-data-resource-config-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/validate-data-resource-config-detail.png -------------------------------------------------------------------------------- /website/img/validate-provider-config-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/validate-provider-config-detail.png -------------------------------------------------------------------------------- /website/img/validate-resource-config-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/terraform-plugin-framework/8a7303c9a6ca60b8a7282848c910b2024c762eac/website/img/validate-resource-config-detail.png -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "terraform-plugin-framework-docs-preview", 3 | "private": "true", 4 | "scripts": { 5 | "build": "./scripts/website-build.sh", 6 | "content-check": "hc-content --config base-docs" 7 | }, 8 | "devDependencies": { 9 | "@hashicorp/platform-content-conformance": "^0.0.8", 10 | "next": "^13.5.4" 11 | }, 12 | "engines": { 13 | "npm": ">=7.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /website/scripts/should-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) HashiCorp, Inc. 3 | # SPDX-License-Identifier: MPL-2.0 4 | 5 | 6 | ###################################################### 7 | # NOTE: This file is managed by the Digital Team's # 8 | # Terraform configuration @ hashicorp/mktg-terraform # 9 | ###################################################### 10 | 11 | # This is run during the website build step to determine if we should skip the build or not. 12 | # More information: https://vercel.com/docs/platform/projects#ignored-build-step 13 | 14 | if [[ "$VERCEL_GIT_COMMIT_REF" == "stable-website" ]] ; then 15 | # Proceed with the build if the branch is stable-website 16 | echo "✅ - Build can proceed" 17 | exit 1; 18 | else 19 | # Check for differences in the website directory 20 | git diff --quiet HEAD^ HEAD ./ 21 | fi --------------------------------------------------------------------------------