Skip to content

Commit

Permalink
r/security_dynamic_address_name: add session_scan argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremmfr committed Jan 27, 2025
1 parent 6702fdb commit 9537c05
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .changes/security-dynamic-address-with-fwk.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ ENHANCEMENTS:
some of config errors are now sent during Plan instead of during Apply
optional boolean attributes doesn't accept value *false*
optional string attributes doesn't accept *empty* value
* **resource/junos_security_dynamic_address_name**: resource now use new [terraform-plugin-framework](https://github.com/hashicorp/terraform-plugin-framework)
* **resource/junos_security_dynamic_address_name**:
* resource now use new [terraform-plugin-framework](https://github.com/hashicorp/terraform-plugin-framework)
some of config errors are now sent during Plan instead of during Apply
optional boolean attributes doesn't accept value *false*
optional string attributes doesn't accept *empty* value
the resource schema has been upgraded to have one-blocks in single mode instead of list
* add `session_scan` argument
2 changes: 2 additions & 0 deletions docs/resources/security_dynamic_address_name.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ The following arguments are supported:
Declare `profile category` configuration to categorize feed data into this dynamic address.
Need to set one of `profile_feed_name` or `profile_category`.
See [below for nested schema](#profile_category-arguments).
- **session_scan** (Optional, Boolean)
Trigger session scan when the IP address is added.

### profile_category arguments

Expand Down
14 changes: 14 additions & 0 deletions internal/providerfwk/resource_security_dynamic_address_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ func (rsc *securityDynamicAddressName) Schema(
tfvalidator.StringFormat(tfvalidator.DefaultFormat),
},
},
"session_scan": schema.BoolAttribute{
Optional: true,
Description: "Trigger session scan when the IP address is added.",
Validators: []validator.Bool{
tfvalidator.BoolTrue(),
},
},
},
Blocks: map[string]schema.Block{
"profile_category": schema.SingleNestedBlock{
Expand Down Expand Up @@ -184,6 +191,7 @@ type securityDynamicAddressNameData struct {
Name types.String `tfsdk:"name"`
Description types.String `tfsdk:"description"`
ProfileFeedName types.String `tfsdk:"profile_feed_name"`
SessionScan types.Bool `tfsdk:"session_scan"`
ProfileCategory *securityDynamicAddressNameBlockProfileCategory `tfsdk:"profile_category"`
}

Expand All @@ -192,6 +200,7 @@ type securityDynamicAddressNameConfig struct {
Name types.String `tfsdk:"name"`
Description types.String `tfsdk:"description"`
ProfileFeedName types.String `tfsdk:"profile_feed_name"`
SessionScan types.Bool `tfsdk:"session_scan"`
ProfileCategory *securityDynamicAddressNameBlockProfileCategoryConfig `tfsdk:"profile_category"`
}

Expand Down Expand Up @@ -463,6 +472,9 @@ func (rscData *securityDynamicAddressNameData) set(
if v := rscData.ProfileFeedName.ValueString(); v != "" {
configSet = append(configSet, setPrefix+"profile feed-name "+v)
}
if rscData.SessionScan.ValueBool() {
configSet = append(configSet, setPrefix+"session-scan")
}

if rscData.ProfileCategory != nil {
blockSet, pathErr, err := rscData.ProfileCategory.configSet(setPrefix)
Expand Down Expand Up @@ -547,6 +559,8 @@ func (rscData *securityDynamicAddressNameData) read(
return err
}
}
case itemTrim == "session-scan":
rscData.SessionScan = types.BoolValue(true)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
resource "junos_security_dynamic_address_name" "testacc_dyn_add_name" {
name = "tfacc_dynadd"
description = "desc tfacc dynamic-address"
name = "tfacc_dynadd"
description = "desc tfacc dynamic-address"
session_scan = true
profile_category {
name = "GeoIP"
feed = "cat_feed"
Expand Down

0 comments on commit 9537c05

Please sign in to comment.