-
Notifications
You must be signed in to change notification settings - Fork 208
chore: Adds provider_meta schema #3619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import ( | |
"github.com/hashicorp/terraform-plugin-framework/datasource" | ||
"github.com/hashicorp/terraform-plugin-framework/diag" | ||
"github.com/hashicorp/terraform-plugin-framework/provider" | ||
"github.com/hashicorp/terraform-plugin-framework/provider/metaschema" | ||
"github.com/hashicorp/terraform-plugin-framework/provider/schema" | ||
"github.com/hashicorp/terraform-plugin-framework/providerserver" | ||
"github.com/hashicorp/terraform-plugin-framework/resource" | ||
|
@@ -52,11 +53,17 @@ import ( | |
) | ||
|
||
const ( | ||
MongodbGovCloudURL = "https://cloud.mongodbgov.com" | ||
MongodbGovCloudQAURL = "https://cloud-qa.mongodbgov.com" | ||
MongodbGovCloudDevURL = "https://cloud-dev.mongodbgov.com" | ||
ProviderConfigError = "error in configuring the provider." | ||
MissingAuthAttrError = "either Atlas Programmatic API Keys or AWS Secrets Manager attributes must be set" | ||
MongodbGovCloudURL = "https://cloud.mongodbgov.com" | ||
MongodbGovCloudQAURL = "https://cloud-qa.mongodbgov.com" | ||
MongodbGovCloudDevURL = "https://cloud-dev.mongodbgov.com" | ||
ProviderConfigError = "error in configuring the provider." | ||
MissingAuthAttrError = "either Atlas Programmatic API Keys or AWS Secrets Manager attributes must be set" | ||
ProviderMetaUserAgentExtra = "user_agent_extra" | ||
ProviderMetaUserAgentExtraDesc = "Key Values of that will be formatted as {key}/{value} in the User-Agent Header" | ||
marcosuma marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
ProviderMetaModuleName = "module_name" | ||
ProviderMetaModuleNameDesc = "The name of the module using the provider" | ||
ProviderMetaModuleVersion = "module_version" | ||
ProviderMetaModuleVersionDesc = "The version of the module using the provider" | ||
) | ||
|
||
type MongodbtlasProvider struct { | ||
|
@@ -106,6 +113,26 @@ func (p *MongodbtlasProvider) Metadata(ctx context.Context, req provider.Metadat | |
resp.Version = version.ProviderVersion | ||
} | ||
|
||
func (p *MongodbtlasProvider) MetaSchema(ctx context.Context, req provider.MetaSchemaRequest, resp *provider.MetaSchemaResponse) { | ||
resp.Schema = metaschema.Schema{ | ||
Attributes: map[string]metaschema.Attribute{ | ||
ProviderMetaModuleName: metaschema.StringAttribute{ | ||
Description: ProviderMetaModuleNameDesc, | ||
Optional: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't we want to have this required if provider_meta is used? similar for version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. |
||
}, | ||
ProviderMetaModuleVersion: metaschema.StringAttribute{ | ||
Description: ProviderMetaModuleVersionDesc, | ||
Optional: true, | ||
}, | ||
ProviderMetaUserAgentExtra: metaschema.MapAttribute{ | ||
Description: ProviderMetaUserAgentExtraDesc, | ||
Optional: true, | ||
ElementType: types.StringType, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func (p *MongodbtlasProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) { | ||
resp.Schema = schema.Schema{ | ||
Blocks: map[string]schema.Block{ | ||
|
Uh oh!
There was an error while loading. Please reload this page.