Skip to content

Commit

Permalink
PET-2876: fix environment variables
Browse files Browse the repository at this point in the history
Signed-off-by: Niklas Ott <[email protected]>
  • Loading branch information
ceriath committed May 31, 2024
1 parent 0e8bf49 commit 9a96a2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
28 changes: 14 additions & 14 deletions internal/provider/sys11dbaas_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ func (p *Sys11DBaaSProvider) Schema(_ context.Context, _ provider.SchemaRequest,
Description: "URL of the DBaaS API. If omitted, the `SYS11DBAAS_URL` environment variable is used. Otherwise fallbacks to https://dbaas.apis.syseleven.de",
},
"api_key": schema.StringAttribute{
Required: true,
Optional: false,
Required: false,
Optional: true,
Description: "API key to use for authentication to the DBaaS API. If omitted, the `SYS11DBAAS_API_KEY` environment variable is used.",
},
"organization": schema.StringAttribute{
Required: true,
Optional: false,
Required: false,
Optional: true,
Description: "ID of your organization. If omitted, the `SYS11DBAAS_ORGANIZATION` environment variable is used.",
},
"project": schema.StringAttribute{
Required: true,
Optional: false,
Required: false,
Optional: true,
Description: "ID of your project. If omitted, the `SYS11DBAAS_PROJECT` environment variable is used.",
},
"wait_for_creation": schema.BoolAttribute{
Expand Down Expand Up @@ -194,28 +194,28 @@ func (p *Sys11DBaaSProvider) Configure(ctx context.Context, req provider.Configu
resp.Diagnostics.AddAttributeError(
path.Root("api_key"),
"Missing Sys11DBaaS API ApiKey",
"The provider cannot create the Sys11DBaaS API client as there is a missing or empty value for the Sys11DBaaS API username. "+
"Set the username value in the configuration or use the SYS11DBAAS_USERNAME environment variable. "+
"The provider cannot create the Sys11DBaaS API client as there is a missing or empty value for the Sys11DBaaS API ApiKey. "+
"Set the api_key value in the configuration or use the SYS11DBAAS_API_KEY environment variable. "+
"If either is already set, ensure the value is not empty.",
)
}

if organization == "" {
resp.Diagnostics.AddAttributeError(
path.Root("organization"),
"Missing Sys11DBaaS API ApiKey",
"The provider cannot create the Sys11DBaaS API client as there is a missing or empty value for the Sys11DBaaS API username. "+
"Set the username value in the configuration or use the SYS11DBAAS_USERNAME environment variable. "+
"Missing Sys11DBaaS organization",
"The provider cannot create the Sys11DBaaS API client as there is a missing or empty value for the Sys11DBaaS organization. "+
"Set the organization value in the configuration or use the SYS11DBAAS_ORGANIZATION environment variable. "+
"If either is already set, ensure the value is not empty.",
)
}

if project == "" {
resp.Diagnostics.AddAttributeError(
path.Root("project"),
"Missing Sys11DBaaS API ApiKey",
"The provider cannot create the Sys11DBaaS API client as there is a missing or empty value for the Sys11DBaaS API username. "+
"Set the username value in the configuration or use the SYS11DBAAS_USERNAME environment variable. "+
"Missing Sys11DBaaS project",
"The provider cannot create the Sys11DBaaS API client as there is a missing or empty value for the Sys11DBaaS project. "+
"Set the project value in the configuration or use the SYS11DBAAS_PROJECT environment variable. "+
"If either is already set, ensure the value is not empty.",
)
}
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ func main() {
flag.Parse()

opts := providerserver.ServeOpts{
// TODO: Update this string with the published name of your provider.
Address: "github.com/syseleven/terraform-provider-sys11dbaas",
Address: "registry.terraform.io/syseleven/sys11dbaas",
Debug: debug,
}

Expand Down

0 comments on commit 9a96a2f

Please sign in to comment.