Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_palo_alto_local_rulestack_rule - correctly populate protocol property #26510

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Changes from 3 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
10 changes: 5 additions & 5 deletions internal/services/paloalto/local_rulestack_rule_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ func (r LocalRuleStackRule) Arguments() map[string]*pluginsdk.Schema {
Default: protocolApplicationDefault,
ValidateFunc: validate.ProtocolWithPort,
ConflictsWith: []string{"protocol_ports"},
// if `protocol_ports` is set, the default value should not be used
DiffSuppressFunc: func(k, old, new string, d *pluginsdk.ResourceData) bool {
return len(d.Get("protocol_ports").([]interface{})) > 0 && old == "" && new == protocolApplicationDefault
},
},

"protocol_ports": {
Expand Down Expand Up @@ -341,11 +345,7 @@ func (r LocalRuleStackRule) Read() sdk.ResourceFunc {
}
state.NegateDestination = boolEnumAsBoolRule(props.NegateDestination)
state.NegateSource = boolEnumAsBoolRule(props.NegateSource)
if v := pointer.From(props.Protocol); v != "" && !strings.EqualFold(v, protocolApplicationDefault) {
state.Protocol = v
} else {
state.Protocol = protocolApplicationDefault
}
state.Protocol = pointer.From(props.Protocol)
state.ProtocolPorts = pointer.From(props.ProtocolPortList)
state.RuleEnabled = stateEnumAsBool(props.RuleState)
state.Source = schema.FlattenSource(props.Source, *id)
Expand Down
Loading