Skip to content

Commit

Permalink
r/security: add routing_instance argument in idp_security_package block
Browse files Browse the repository at this point in the history
fix #754
  • Loading branch information
jeremmfr committed Feb 17, 2025
1 parent 79c0419 commit 55dcdcb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .changes/issue-754.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- markdownlint-disable-file MD013 MD041 -->
ENHANCEMENTS:

* **resource/junos_security**: add `routing_instance` argument in `idp_security_package` block (Fix [#754](https://github.com/jeremmfr/terraform-provider-junos/issues/754))
2 changes: 2 additions & 0 deletions docs/resources/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ The following arguments are supported:
Skip version check when attack database gets installed.
- **proxy_profile** (Optional, String)
Proxy profile of security package download.
- **routing_instance** (Optional, String)
Routing instance for security-package download.
- **source_address** (Optional, String)
Source address to be used for sending download request.
- **url** (Optional, String)
Expand Down
15 changes: 15 additions & 0 deletions internal/providerfwk/resource_security.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,14 @@ func (rsc *security) Schema(
tfvalidator.StringDoubleQuoteExclusion(),
},
},
"routing_instance": schema.StringAttribute{
Optional: true,
Description: "Routing instance for security-package download.",
Validators: []validator.String{
stringvalidator.LengthBetween(1, 63),
tfvalidator.StringFormat(tfvalidator.DefaultFormat),
},
},
"source_address": schema.StringAttribute{
Optional: true,
Description: "Source address to be used for sending download request.",
Expand Down Expand Up @@ -1452,6 +1460,7 @@ type securityBlockIdpSecurityPackage struct {
AutomaticStartTime types.String `tfsdk:"automatic_start_time"`
InstallIgnoreVersionCheck types.Bool `tfsdk:"install_ignore_version_check"`
ProxyProfile types.String `tfsdk:"proxy_profile"`
RoutingInstance types.String `tfsdk:"routing_instance"`
SourceAddress types.String `tfsdk:"source_address"`
URL types.String `tfsdk:"url"`
}
Expand Down Expand Up @@ -2486,6 +2495,9 @@ func (block *securityBlockIdpSecurityPackage) configSet() []string {
if v := block.ProxyProfile.ValueString(); v != "" {
configSet = append(configSet, setPrefix+"proxy-profile \""+v+"\"")
}
if v := block.RoutingInstance.ValueString(); v != "" {
configSet = append(configSet, setPrefix+"routing-instance "+v)
}
if v := block.SourceAddress.ValueString(); v != "" {
configSet = append(configSet, setPrefix+"source-address "+v)
}
Expand Down Expand Up @@ -3214,6 +3226,7 @@ func (securityBlockIdpSecurityPackage) junosLines() []string {
"idp security-package automatic",
"idp security-package install",
"idp security-package proxy-profile",
"idp security-package routing-instance",
"idp security-package source-address",
"idp security-package url",
}
Expand All @@ -3236,6 +3249,8 @@ func (block *securityBlockIdpSecurityPackage) read(itemTrim string) (err error)
block.InstallIgnoreVersionCheck = types.BoolValue(true)
case balt.CutPrefixInString(&itemTrim, "proxy-profile "):
block.ProxyProfile = types.StringValue(strings.Trim(itemTrim, "\""))
case balt.CutPrefixInString(&itemTrim, "routing-instance "):
block.RoutingInstance = types.StringValue(itemTrim)
case balt.CutPrefixInString(&itemTrim, "source-address "):
block.SourceAddress = types.StringValue(itemTrim)
case balt.CutPrefixInString(&itemTrim, "url "):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ resource "junos_security" "testacc_security" {
}
}
}
idp_security_package {
routing_instance = junos_routing_instance.testacc_security.name
}
idp_sensor_configuration {
log_suppression {
include_destination_address = true
Expand Down

0 comments on commit 55dcdcb

Please sign in to comment.