Skip to content

Log provider client details #3099

Closed
Closed
@Gnoale

Description

@Gnoale

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

During provider creation, the scw.Client is created with a certain order regarding the environments : secrets, default project if, default organization id etc.

For instance, environment variable takes precedence over the provider configuration

We don't want to change the order at the moment

However, we should be more explicit in the logs during the resource plan:

1 via tflog, we could log with level info, the region and the project_id where the resource would be created

this is doable at the provider level, however this might not be very insightful because the logs are only displayed if TF_LOG=info, if warn or error is used the logs will be displayed the same way

2025-05-21T13:49:30.791+0200 [INFO]  provider.terraform-provider-scaleway: Planning resource creation with the following parameters: project_id=11111111-1111-1111-1111-111111111111 tf_provider_addr=registry.terraform.io/scaleway/scaleway tf_rpc=ConfigureProvider @caller=/Users/gnoale/git/scaleway/terraform-provider-scaleway/internal/provider/provider.go:358 @module=scaleway tf_mux_provider="*schema.GRPCProviderServer" tf_req_id=c2a80240-d3f7-2f39-a836-e46c1bd2ecc0 organization_id=22222222-2222-2222-2222-222222222222 region=fr-par timestamp="2025-05-21T13:49:30.791+0200"

2 warn users about duplicate configurations during the client construction

Suggestion

Plan: 3 to add, 1 to change, 1 to destroy.
╷
│ Warning: Planning resource creation with the following parameters
│
│   with provider["registry.terraform.io/scaleway/scaleway"],
│   on main.tf line 21, in provider "scaleway":
│   21: provider "scaleway" {
│
│ region=fr-par
│ project_id=11111111-1111-1111-1111-111111111111
│ organization_id=22222222-2222-2222-2222-222222222222
╵

New or Affected Resource(s)

all

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

  • #0000

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions