Skip to content

Commit d5f4e7d

Browse files
fix: correctly detect more ID attributes for data sources
1 parent d0fe7b8 commit d5f4e7d

File tree

272 files changed

+585
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+585
-292
lines changed

internal/customvalidator/dynamicvalidator_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ var testcases = map[string](struct {
208208
[]attr.Value{
209209
basetypes.NewListValueMust(basetypes.StringType{}, []attr.Value{basetypes.NewStringValue("")}),
210210
basetypes.NewListValueMust(basetypes.StringType{}, []attr.Value{}),
211+
basetypes.NewTupleValueMust([]attr.Type{basetypes.StringType{}, basetypes.StringType{}}, []attr.Value{basetypes.NewStringValue(""), basetypes.NewStringValue("")}),
211212
basetypes.NewSetValueMust(basetypes.StringType{}, []attr.Value{basetypes.NewStringValue("")}),
212213
},
213214
[]attr.Value{

internal/services/access_rule/data_source.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func (d *AccessRuleDataSource) Read(ctx context.Context, req datasource.ReadRequ
113113
return
114114
}
115115
data = &env.Result
116+
data.ID = data.RuleID
116117

117118
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
118119
}

internal/services/account/data_source.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func (d *AccountDataSource) Read(ctx context.Context, req datasource.ReadRequest
112112
return
113113
}
114114
data = &env.Result
115+
data.ID = data.AccountID
115116

116117
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
117118
}

internal/services/account_dns_settings_internal_view/data_source.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func (d *AccountDNSSettingsInternalViewDataSource) Read(ctx context.Context, req
113113
return
114114
}
115115
data = &env.Result
116+
data.ID = data.ViewID
116117

117118
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
118119
}

internal/services/account_member/data_source.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func (d *AccountMemberDataSource) Read(ctx context.Context, req datasource.ReadR
113113
return
114114
}
115115
data = &env.Result
116+
data.ID = data.MemberID
116117

117118
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
118119
}

internal/services/account_subscription/data_source.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func (d *AccountSubscriptionDataSource) Read(ctx context.Context, req datasource
8282
return
8383
}
8484
data = &env.Result
85+
data.ID = data.AccountID
8586

8687
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
8788
}

internal/services/account_subscription/data_source_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ type AccountSubscriptionResultDataSourceEnvelope struct {
1818
}
1919

2020
type AccountSubscriptionDataSourceModel struct {
21+
ID types.String `tfsdk:"id" path:"account_id,computed"`
2122
AccountID types.String `tfsdk:"account_id" path:"account_id,required"`
2223
Currency types.String `tfsdk:"currency" json:"currency,computed"`
2324
CurrentPeriodEnd timetypes.RFC3339 `tfsdk:"current_period_end" json:"current_period_end,computed" format:"date-time"`
2425
CurrentPeriodStart timetypes.RFC3339 `tfsdk:"current_period_start" json:"current_period_start,computed" format:"date-time"`
2526
Frequency types.String `tfsdk:"frequency" json:"frequency,computed"`
26-
ID types.String `tfsdk:"id" json:"id,computed"`
2727
Price types.Float64 `tfsdk:"price" json:"price,computed"`
2828
State types.String `tfsdk:"state" json:"state,computed"`
2929
RatePlan customfield.NestedObject[AccountSubscriptionRatePlanDataSourceModel] `tfsdk:"rate_plan" json:"rate_plan,computed"`

internal/services/account_subscription/data_source_schema.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ var _ datasource.DataSourceWithConfigValidators = (*AccountSubscriptionDataSourc
1919
func DataSourceSchema(ctx context.Context) schema.Schema {
2020
return schema.Schema{
2121
Attributes: map[string]schema.Attribute{
22+
"id": schema.StringAttribute{
23+
Description: "Identifier",
24+
Computed: true,
25+
},
2226
"account_id": schema.StringAttribute{
2327
Description: "Identifier",
2428
Required: true,
@@ -49,10 +53,6 @@ func DataSourceSchema(ctx context.Context) schema.Schema {
4953
),
5054
},
5155
},
52-
"id": schema.StringAttribute{
53-
Description: "Subscription identifier tag.",
54-
Computed: true,
55-
},
5656
"price": schema.Float64Attribute{
5757
Description: "The price of the subscription that will be billed, in US dollars.",
5858
Computed: true,

internal/services/account_token/data_source.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func (d *AccountTokenDataSource) Read(ctx context.Context, req datasource.ReadRe
113113
return
114114
}
115115
data = &env.Result
116+
data.ID = data.TokenID
116117

117118
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
118119
}

internal/services/address_map/data_source.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func (d *AddressMapDataSource) Read(ctx context.Context, req datasource.ReadRequ
8383
return
8484
}
8585
data = &env.Result
86+
data.ID = data.AddressMapID
8687

8788
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
8889
}

0 commit comments

Comments
 (0)