@@ -51,17 +51,14 @@ type vpcFirewallRulesResourceModel struct {
5151}
5252
5353type vpcFirewallRulesResourceRuleModel struct {
54- Action types.String `tfsdk:"action"`
55- Description types.String `tfsdk:"description"`
56- Direction types.String `tfsdk:"direction"`
57- Filters * vpcFirewallRulesResourceRuleFiltersModel `tfsdk:"filters"`
58- ID types.String `tfsdk:"id"`
59- Name types.String `tfsdk:"name"`
60- Priority types.Int64 `tfsdk:"priority"`
61- Status types.String `tfsdk:"status"`
62- Targets []vpcFirewallRulesResourceRuleTargetModel `tfsdk:"targets"`
63- TimeCreated types.String `tfsdk:"time_created"`
64- TimeModified types.String `tfsdk:"time_modified"`
54+ Action types.String `tfsdk:"action"`
55+ Description types.String `tfsdk:"description"`
56+ Direction types.String `tfsdk:"direction"`
57+ Filters * vpcFirewallRulesResourceRuleFiltersModel `tfsdk:"filters"`
58+ Name types.String `tfsdk:"name"`
59+ Priority types.Int64 `tfsdk:"priority"`
60+ Status types.String `tfsdk:"status"`
61+ Targets []vpcFirewallRulesResourceRuleTargetModel `tfsdk:"targets"`
6562}
6663
6764type vpcFirewallRulesResourceRuleTargetModel struct {
@@ -110,6 +107,10 @@ func (r *vpcFirewallRulesResource) Schema(ctx context.Context, _ resource.Schema
110107 stringplanmodifier .RequiresReplace (),
111108 },
112109 },
110+ // The rules attribute cannot contain computed attributes since the upstream API
111+ // returns updated attributes for every rule, irrespective of which rules actually
112+ // change. See https://github.com/oxidecomputer/terraform-provider-oxide/issues/453
113+ // for more information.
113114 "rules" : schema.SetNestedAttribute {
114115 Required : true ,
115116 Description : "Associated firewall rules." ,
@@ -202,10 +203,6 @@ func (r *vpcFirewallRulesResource) Schema(ctx context.Context, _ resource.Schema
202203 },
203204 },
204205 },
205- "id" : schema.StringAttribute {
206- Computed : true ,
207- Description : "Unique, immutable, system-controlled identifier of the firewall rule." ,
208- },
209206 "name" : schema.StringAttribute {
210207 Required : true ,
211208 Description : "Name of the VPC firewall rule." ,
@@ -255,14 +252,6 @@ func (r *vpcFirewallRulesResource) Schema(ctx context.Context, _ resource.Schema
255252 },
256253 },
257254 },
258- "time_created" : schema.StringAttribute {
259- Computed : true ,
260- Description : "Timestamp of when this VPC firewall rule was created." ,
261- },
262- "time_modified" : schema.StringAttribute {
263- Computed : true ,
264- Description : "Timestamp of when this VPC firewall rule was last modified." ,
265- },
266255 },
267256 },
268257 },
@@ -536,14 +525,11 @@ func newVPCFirewallRulesModel(rules []oxide.VpcFirewallRule) ([]vpcFirewallRules
536525 Action : types .StringValue (string (rule .Action )),
537526 Description : types .StringValue (rule .Description ),
538527 Direction : types .StringValue (string (rule .Direction )),
539- ID : types .StringValue (rule .Id ),
540528 Name : types .StringValue (string (rule .Name )),
541529 // We can safely dereference rule.Priority as it's a required field
542- Priority : types .Int64Value (int64 (* rule .Priority )),
543- Status : types .StringValue (string (rule .Status )),
544- Targets : newTargetsModelFromResponse (rule .Targets ),
545- TimeCreated : types .StringValue (rule .TimeCreated .String ()),
546- TimeModified : types .StringValue (rule .TimeModified .String ()),
530+ Priority : types .Int64Value (int64 (* rule .Priority )),
531+ Status : types .StringValue (string (rule .Status )),
532+ Targets : newTargetsModelFromResponse (rule .Targets ),
547533 }
548534
549535 filters , diags := newFiltersModelFromResponse (rule .Filters )
0 commit comments