Documentation ¶
Overview ¶
Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0
Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0
Index ¶
- func New(primary *sdk_schema.Provider) provider.ProviderWithMetaSchema
- func NewGoogleProviderConfigPluginFrameworkDataSource() datasource.DataSource
- type FrameworkProvider
- func (p *FrameworkProvider) Configure(ctx context.Context, req provider.ConfigureRequest, ...)
- func (p *FrameworkProvider) DataSources(_ context.Context) []func() datasource.DataSource
- func (p *FrameworkProvider) EphemeralResources(_ context.Context) []func() ephemeral.EphemeralResource
- func (p *FrameworkProvider) Functions(_ context.Context) []func() function.Function
- func (p *FrameworkProvider) MetaSchema(_ context.Context, _ provider.MetaSchemaRequest, ...)
- func (p *FrameworkProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse)
- func (p *FrameworkProvider) Resources(_ context.Context) []func() resource.Resource
- func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse)
- type GoogleProviderConfigPluginFrameworkDataSource
- func (d *GoogleProviderConfigPluginFrameworkDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, ...)
- func (d *GoogleProviderConfigPluginFrameworkDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, ...)
- func (d *GoogleProviderConfigPluginFrameworkDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
- func (d *GoogleProviderConfigPluginFrameworkDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, ...)
- type GoogleProviderConfigPluginFrameworkModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(primary *sdk_schema.Provider) provider.ProviderWithMetaSchema
New is a helper function to simplify provider server and testing implementation.
func NewGoogleProviderConfigPluginFrameworkDataSource ¶
func NewGoogleProviderConfigPluginFrameworkDataSource() datasource.DataSource
Types ¶
type FrameworkProvider ¶
type FrameworkProvider struct { Version string Primary *sdk_schema.Provider }
FrameworkProvider is the provider implementation.
func (*FrameworkProvider) Configure ¶
func (p *FrameworkProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse)
Configure prepares the metadata/'meta' required for data sources and resources to function. Configuration logic implemented here should take user inputs and use them to populate a struct with that necessary metadata, e.g. default project value, configured client, etc. That prepared 'meta' struct is then returned in the response, and that value will later be supplied to all resources/data sources when they need to configure themselves.
func (*FrameworkProvider) DataSources ¶
func (p *FrameworkProvider) DataSources(_ context.Context) []func() datasource.DataSource
DataSources defines the data sources implemented in the provider.
func (*FrameworkProvider) EphemeralResources ¶
func (p *FrameworkProvider) EphemeralResources(_ context.Context) []func() ephemeral.EphemeralResource
EphemeralResources defines the resources that are of ephemeral type implemented in the provider.
func (*FrameworkProvider) Functions ¶
func (p *FrameworkProvider) Functions(_ context.Context) []func() function.Function
Functions defines the provider functions implemented in the provider.
func (*FrameworkProvider) MetaSchema ¶
func (p *FrameworkProvider) MetaSchema(_ context.Context, _ provider.MetaSchemaRequest, resp *provider.MetaSchemaResponse)
MetaSchema returns the provider meta schema.
func (*FrameworkProvider) Metadata ¶
func (p *FrameworkProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse)
Metadata returns - the provider type name : this controls how "google" is present at the start of all resource type names - the provider version : this is currently unused by Terraform core
func (*FrameworkProvider) Resources ¶
func (p *FrameworkProvider) Resources(_ context.Context) []func() resource.Resource
Resources defines the resources implemented in the provider.
func (*FrameworkProvider) Schema ¶
func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse)
Schema defines the provider-level schema for configuration data. See: https://developer.hashicorp.com/terraform/plugin/framework/migrating/mux "The schema and configuration handling must exactly match between all underlying providers of the mux server" This schema matches the schema implemented with SDKv2 in google/provider/provider.go
type GoogleProviderConfigPluginFrameworkDataSource ¶
type GoogleProviderConfigPluginFrameworkDataSource struct {
// contains filtered or unexported fields
}
func (*GoogleProviderConfigPluginFrameworkDataSource) Configure ¶
func (d *GoogleProviderConfigPluginFrameworkDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse)
func (*GoogleProviderConfigPluginFrameworkDataSource) Metadata ¶
func (d *GoogleProviderConfigPluginFrameworkDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse)
func (*GoogleProviderConfigPluginFrameworkDataSource) Read ¶
func (d *GoogleProviderConfigPluginFrameworkDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
func (*GoogleProviderConfigPluginFrameworkDataSource) Schema ¶
func (d *GoogleProviderConfigPluginFrameworkDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse)
type GoogleProviderConfigPluginFrameworkModel ¶
type GoogleProviderConfigPluginFrameworkModel struct { Credentials types.String `tfsdk:"credentials"` AccessToken types.String `tfsdk:"access_token"` ImpersonateServiceAccount types.String `tfsdk:"impersonate_service_account"` ImpersonateServiceAccountDelegates types.List `tfsdk:"impersonate_service_account_delegates"` Project types.String `tfsdk:"project"` BillingProject types.String `tfsdk:"billing_project"` Region types.String `tfsdk:"region"` Zone types.String `tfsdk:"zone"` Scopes types.List `tfsdk:"scopes"` // omit Batching UserProjectOverride types.Bool `tfsdk:"user_project_override"` RequestTimeout types.String `tfsdk:"request_timeout"` RequestReason types.String `tfsdk:"request_reason"` UniverseDomain types.String `tfsdk:"universe_domain"` DefaultLabels types.Map `tfsdk:"default_labels"` AddTerraformAttributionLabel types.Bool `tfsdk:"add_terraform_attribution_label"` TerraformAttributionLabelAdditionStrategy types.String `tfsdk:"terraform_attribution_label_addition_strategy"` }
GoogleProviderConfigPluginFrameworkModel describes the data source and matches the schema. Its fields match those in a Config struct (google/transport/config.go) but uses a different type system.
- In the original Config struct old SDK/Go primitives types are used, e.g. `string`
- Here in the GoogleProviderConfigPluginFrameworkModel struct we need to use the terraform-plugin-framework/types type system, e.g. `types.String`
- This is needed because the PF type system is 'baked into' how we define schemas. The schema will expect a nullable type.
- See terraform-plugin-framework/datasource/schema#StringAttribute's CustomType: https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework@v1.7.0/datasource/schema#StringAttribute
- Due to the different type systems of Config versus GoogleProviderConfigPluginFrameworkModel struct, we need to convert from primitive types to terraform-plugin-framework/types when we populate GoogleProviderConfigPluginFrameworkModel structs with data in this data source's Read method.