Skip to content

Commit

Permalink
Fix idempotency issue with various resource and boolean values
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Nov 22, 2023
1 parent f13ec0f commit 12dde0e
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 161 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.11 (unreleased)

- Fix idempotency issue with various resource and boolean values

## 0.2.10

- Fix issue with `sdwan_cisco_ospf_feature_template` resource when not configuring route policies
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/cisco_vpn_interface_feature_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ data "sdwan_cisco_vpn_interface_feature_template" "example" {
- `nat_pool_range_start_variable` (String) Variable name
- `nat_type` (String) NAT type
- `nat_type_variable` (String) Variable name
- `nat_variable` (String) Variable name
- `per_tunnel_qos` (Boolean) Per-tunnel Qos
- `per_tunnel_qos_aggregator` (Boolean) Per-tunnel QoS Aggregator
- `per_tunnel_qos_aggregator_variable` (String) Variable name
Expand Down
1 change: 0 additions & 1 deletion docs/resources/cisco_vpn_interface_feature_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ resource "sdwan_cisco_vpn_interface_feature_template" "example" {
- Choices: `interface`, `pool`, `loopback`
- Default value: `interface`
- `nat_type_variable` (String) Variable name
- `nat_variable` (String) Variable name
- `per_tunnel_qos` (Boolean) Per-tunnel Qos
- Default value: `false`
- `per_tunnel_qos_aggregator` (Boolean) Per-tunnel QoS Aggregator
Expand Down
1 change: 1 addition & 0 deletions gen/definitions/feature_templates/cisco_ospf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ attributes:
example: true
- model_name: originate
tf_name: default_information_originate
node_only_container: true
example: true
- model_name: always
tf_name: default_information_originate_always
Expand Down
12 changes: 12 additions & 0 deletions gen/definitions/feature_templates/cisco_vpn_interface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,37 @@ attributes:
- model_name: iperf-server
example: 8.8.8.8
- model_name: nat
node_only_container: true
example: true
- model_name: nat-choice
tf_name: nat_type
exclude_ignore: true
example: interface
- model_name: udp-timeout
exclude_ignore: true
example: 1
- model_name: tcp-timeout
exclude_ignore: true
example: 60
- model_name: range-start
tf_name: nat_pool_range_start
exclude_ignore: true
example: 10.1.1.1
- model_name: range-end
tf_name: nat_pool_range_end
exclude_ignore: true
example: 10.1.1.255
- model_name: overload
tf_name: nat_overload
exclude_ignore: true
example: false
- model_name: loopback-interface
tf_name: nat_inside_source_loopback_interface
exclude_ignore: true
example: lo1
- model_name: prefix-length
tf_name: nat_pool_prefix_length
exclude_ignore: true
example: 24
- model_name: enable
data_path: [nat64]
Expand All @@ -101,6 +110,7 @@ attributes:
example: false
- model_name: static-nat66
tf_name: static_nat66_entries
exclude_ignore: true
attributes:
- model_name: source-prefix
example: 2001:7::/48
Expand All @@ -110,6 +120,7 @@ attributes:
example: 1
- model_name: static
tf_name: static_nat_entries
exclude_ignore: true
attributes:
- model_name: source-ip
example: 10.1.1.1
Expand All @@ -122,6 +133,7 @@ attributes:
example: 1
- model_name: static-port-forward
tf_name: static_port_forward_entries
exclude_ignore: true
attributes:
- model_name: source-ip
example: 10.1.1.1
Expand Down
3 changes: 2 additions & 1 deletion gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ type YamlConfigAttribute struct {
ExcludeTest bool `yaml:"exclude_test"`
ExcludeExample bool `yaml:"exclude_example"`
ExcludeIgnore bool `yaml:"exclude_ignore"`
NodeOnlyContainer bool `yaml:"node_only_container"`
Description string `yaml:"description"`
Example string `yaml:"example"`
EnumValues []string `yaml:"enum_values"`
Expand Down Expand Up @@ -401,7 +402,7 @@ func parseFeatureTemplateAttribute(attr *YamlConfigAttribute, model gjson.Result
if !ignore && r.Get("objectType").String() != "tree" {
attr.Mandatory = true
}
if variable && r.Get("objectType").String() != "tree" {
if variable && r.Get("objectType").String() != "tree" && !attr.NodeOnlyContainer {
attr.Variable = true
}
if r.Get("objectType").String() == "tree" && len(attr.Attributes) > 0 {
Expand Down
1 change: 1 addition & 0 deletions gen/schema/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ attribute:
exclude_test: bool(required=False)
exclude_example: bool(required=False)
exclude_ignore: bool(required=False) # If true the object will not be included in the payload if vipType="ignore"
node_only_container: bool(required=False) # Some node-only attributes are at the same time a container for other attributes, in this case set to "true"
description: str(required=False)
example: any(str(), int(), bool(), required=False)
enum_values: list(str(), required=False)
Expand Down
71 changes: 64 additions & 7 deletions gen/templates/feature_templates/model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions internal/provider/model_sdwan_cisco_bgp_feature_template.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 12dde0e

Please sign in to comment.