From 38b5ab8dbce8515a88f69bb5eefefc1f19ca0486 Mon Sep 17 00:00:00 2001 From: Andreas Zeissner Date: Fri, 13 Sep 2024 13:41:16 +0200 Subject: [PATCH] chore: do not prefix provider config --- docs/index.md | 8 ++++---- examples/cosmo/provider.tf | 4 ++-- examples/provider/provider.tf | 4 ++-- internal/provider/provider.go | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/index.md b/docs/index.md index 5502ca8..fc6c94d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,8 +23,8 @@ terraform { } provider "cosmo" { - cosmo_api_url = "cosmo_669b576aaadc10ee1ae81d9193425705" - cosmo_api_key = "http://localhost:3001" + api_url = "http://localhost:3001" + api_key = "cosmo_669b576aaadc10ee1ae81d9193425705" } ``` @@ -33,5 +33,5 @@ provider "cosmo" { ### Optional -- `cosmo_api_key` (String) The Api Key to be used: COSMO_API_KEY -- `cosmo_api_url` (String) The Api Url to be used: COSMO_API_URL +- `api_key` (String) The Api Key to be used: COSMO_API_KEY +- `api_url` (String) The Api Url to be used: COSMO_API_URL diff --git a/examples/cosmo/provider.tf b/examples/cosmo/provider.tf index 031f966..ab1f447 100644 --- a/examples/cosmo/provider.tf +++ b/examples/cosmo/provider.tf @@ -8,6 +8,6 @@ terraform { } provider "cosmo" { - cosmo_api_url = "cosmo_669b576aaadc10ee1ae81d9193425705" - cosmo_api_key = "http://localhost:3001" + api_url = "cosmo_669b576aaadc10ee1ae81d9193425705" + api_key = "http://localhost:3001" } diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 031f966..8219298 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -8,6 +8,6 @@ terraform { } provider "cosmo" { - cosmo_api_url = "cosmo_669b576aaadc10ee1ae81d9193425705" - cosmo_api_key = "http://localhost:3001" + api_url = "http://localhost:3001" + api_key = "cosmo_669b576aaadc10ee1ae81d9193425705" } diff --git a/internal/provider/provider.go b/internal/provider/provider.go index ab1b815..d5b32ff 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -38,8 +38,8 @@ type Provider struct { // CosmoProviderModel describes the provider data model. type CosmoProviderModel struct { - CosmoApiUrl types.String `tfsdk:"cosmo_api_url"` - CosmoApiKey types.String `tfsdk:"cosmo_api_key"` + ApiUrl types.String `tfsdk:"api_url"` + ApiKey types.String `tfsdk:"api_key"` } func (p *CosmoProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) { @@ -50,11 +50,11 @@ func (p *CosmoProvider) Metadata(ctx context.Context, req provider.MetadataReque func (p *CosmoProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "cosmo_api_url": schema.StringAttribute{ + "api_url": schema.StringAttribute{ MarkdownDescription: fmt.Sprintf("The Api Url to be used: %s", utils.EnvCosmoApiUrl), Optional: true, }, - "cosmo_api_key": schema.StringAttribute{ + "api_key": schema.StringAttribute{ MarkdownDescription: fmt.Sprintf("The Api Key to be used: %s", utils.EnvCosmoApiKey), Optional: true, }, @@ -71,8 +71,8 @@ func (p *CosmoProvider) Configure(ctx context.Context, req provider.ConfigureReq return } - cosmoApiKey := data.CosmoApiKey.ValueString() - cosmoApiUrl := data.CosmoApiUrl.ValueString() + cosmoApiKey := data.ApiKey.ValueString() + cosmoApiUrl := data.ApiUrl.ValueString() platformClient, err := api.NewClient(cosmoApiKey, cosmoApiUrl)