Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions provider/sdkv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ func SDKProvider(config *Config) plugin.ProviderFunc {

p.ConfigureContextFunc = func(ctx context.Context, data *schema.ResourceData) (any, diag.Diagnostics) {
terraformVersion := p.TerraformVersion
schema.DescriptionKind = schema.StringMarkdown
Comment on lines 369 to +371
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the global variable schema.DescriptionKind inside ConfigureContextFunc is problematic. This function can be called multiple times (e.g., during provider reconfiguration or in test scenarios), and modifying a global variable inside it could lead to race conditions in concurrent usage scenarios.

The DescriptionKind should be set once during provider initialization, not during configuration. Consider moving this line to execute before the provider is returned, outside of the ConfigureContextFunc. For example, it could be placed right after addBetaResources(p) and before setting p.ConfigureContextFunc.

Suggested change
p.ConfigureContextFunc = func(ctx context.Context, data *schema.ResourceData) (any, diag.Diagnostics) {
terraformVersion := p.TerraformVersion
schema.DescriptionKind = schema.StringMarkdown
schema.DescriptionKind = schema.StringMarkdown
p.ConfigureContextFunc = func(ctx context.Context, data *schema.ResourceData) (any, diag.Diagnostics) {
terraformVersion := p.TerraformVersion

Copilot uses AI. Check for mistakes.

// If we provide meta in config use it. This is useful for tests
if config != nil && config.Meta != nil {
Expand Down
Loading