diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d3f97..2fcbc4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.1.8 (unreleased) - Fix default value of `ip_version` attribute of `ise_trustsec_security_group_acl` resource +- Fix idempotency issue with `ise_network_access_condition` and `ise_device_admin_condition` resources ## 0.1.7 diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 9751507..813951a 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -10,6 +10,7 @@ description: |- ## 0.1.8 (unreleased) - Fix default value of `ip_version` attribute of `ise_trustsec_security_group_acl` resource +- Fix idempotency issue with `ise_network_access_condition` and `ise_device_admin_condition` resources ## 0.1.7 diff --git a/gen/definitions/device_admin_condition.yaml b/gen/definitions/device_admin_condition.yaml index 7f8acb2..d197255 100644 --- a/gen/definitions/device_admin_condition.yaml +++ b/gen/definitions/device_admin_condition.yaml @@ -83,6 +83,7 @@ attributes: attributes: - model_name: name type: String + id: true description: Condition name example: Cond1 - model_name: description @@ -91,6 +92,7 @@ attributes: example: My description - model_name: conditionType type: String + id: true mandatory: true enum_values: [ @@ -104,6 +106,7 @@ attributes: - model_name: id tf_name: id type: String + id: true description: UUID for condition example: 12345678-f0e7-456b-a2d1-876543320123 - model_name: isNegate @@ -112,23 +115,28 @@ attributes: example: false - model_name: attributeName type: String + id: true description: Dictionary attribute name example: User - model_name: attributeValue type: String + id: true description: Attribute value for condition. Value type is specified in dictionary object. example: User1 - model_name: dictionaryName type: String + id: true description: Dictionary name example: TACACS - model_name: dictionaryValue type: String + id: true description: Dictionary value example: abc exclude_test: true - model_name: operator type: String + id: true enum_values: [ contains, @@ -160,6 +168,7 @@ attributes: attributes: - model_name: name type: String + id: true description: Condition name example: Cond1 - model_name: description @@ -168,6 +177,7 @@ attributes: example: My description - model_name: conditionType type: String + id: true mandatory: true enum_values: [ @@ -181,6 +191,7 @@ attributes: - model_name: id tf_name: id type: String + id: true description: UUID for condition example: 12345678-f0e7-456b-a2d1-876543320123 - model_name: isNegate @@ -189,23 +200,28 @@ attributes: example: false - model_name: attributeName type: String + id: true description: Dictionary attribute name example: User - model_name: attributeValue type: String + id: true description: Attribute value for condition. Value type is specified in dictionary object. example: User1 - model_name: dictionaryName type: String + id: true description: Dictionary name example: TACACS - model_name: dictionaryValue type: String + id: true description: Dictionary value example: abc exclude_test: true - model_name: operator type: String + id: true enum_values: [ contains, diff --git a/gen/definitions/license_tier_state.yaml b/gen/definitions/license_tier_state.yaml index e419dfc..e41564e 100644 --- a/gen/definitions/license_tier_state.yaml +++ b/gen/definitions/license_tier_state.yaml @@ -17,6 +17,7 @@ attributes: - model_name: name type: String id: true + mandatory: true enum_values: [ESSENTIAL, ADVANTAGE, PREMIER, DEVICEADMIN, VM] description: License name example: ESSENTIAL diff --git a/gen/definitions/network_access_condition.yaml b/gen/definitions/network_access_condition.yaml index 7c7df6d..52c15f7 100644 --- a/gen/definitions/network_access_condition.yaml +++ b/gen/definitions/network_access_condition.yaml @@ -83,6 +83,7 @@ attributes: attributes: - model_name: name type: String + id: true description: Condition name example: Cond1 - model_name: description @@ -91,6 +92,7 @@ attributes: example: My description - model_name: conditionType type: String + id: true mandatory: true enum_values: [ @@ -104,6 +106,7 @@ attributes: - model_name: id tf_name: id type: String + id: true description: UUID for condition example: 12345678-f0e7-456b-a2d1-876543320123 - model_name: isNegate @@ -112,23 +115,28 @@ attributes: example: false - model_name: attributeName type: String + id: true description: Dictionary attribute name example: EapAuthentication - model_name: attributeValue type: String + id: true description: Attribute value for condition. Value type is specified in dictionary object. example: EAP-TLS - model_name: dictionaryName type: String + id: true description: Dictionary name example: Network Access - model_name: dictionaryValue type: String + id: true description: Dictionary value example: abc exclude_test: true - model_name: operator type: String + id: true enum_values: [ contains, @@ -160,6 +168,7 @@ attributes: attributes: - model_name: name type: String + id: true description: Condition name example: Cond1 - model_name: description @@ -168,6 +177,7 @@ attributes: example: My description - model_name: conditionType type: String + id: true mandatory: true enum_values: [ @@ -181,6 +191,7 @@ attributes: - model_name: id tf_name: id type: String + id: true description: UUID for condition example: 12345678-f0e7-456b-a2d1-876543320123 - model_name: isNegate @@ -189,23 +200,28 @@ attributes: example: false - model_name: attributeName type: String + id: true description: Dictionary attribute name example: EapAuthentication - model_name: attributeValue type: String + id: true description: Attribute value for condition. Value type is specified in dictionary object. example: EAP-TLS - model_name: dictionaryName type: String + id: true description: Dictionary name example: Network Access - model_name: dictionaryValue type: String + id: true description: Dictionary value example: abc exclude_test: true - model_name: operator type: String + id: true enum_values: [ contains, diff --git a/gen/definitions/network_access_dictionary.yaml b/gen/definitions/network_access_dictionary.yaml index 43292c0..46be2c2 100644 --- a/gen/definitions/network_access_dictionary.yaml +++ b/gen/definitions/network_access_dictionary.yaml @@ -7,6 +7,7 @@ attributes: - model_name: name type: String id: true + mandatory: true description: The dictionary name example: Dict1 - model_name: description diff --git a/gen/definitions/network_device.yaml b/gen/definitions/network_device.yaml index d1faeef..33a01fe 100644 --- a/gen/definitions/network_device.yaml +++ b/gen/definitions/network_device.yaml @@ -92,6 +92,7 @@ attributes: - model_name: ipaddress type: String id: true + mandatory: true description: It can be either single ip address or ip range address example: 2.3.4.5 - model_name: ipaddressExclude diff --git a/gen/definitions/repository.yaml b/gen/definitions/repository.yaml index 1e41556..6242600 100644 --- a/gen/definitions/repository.yaml +++ b/gen/definitions/repository.yaml @@ -7,6 +7,7 @@ attributes: - model_name: name type: String id: true + mandatory: true description: Repository name should be less than 80 characters and can contain alphanumeric, underscore, hyphen and dot characters. example: repo1 - model_name: protocol diff --git a/gen/templates/resource.go b/gen/templates/resource.go index 2aa2627..ab4f967 100644 --- a/gen/templates/resource.go +++ b/gen/templates/resource.go @@ -96,7 +96,7 @@ func (r *{{camelCase .Name}}Resource) Schema(ctx context.Context, req resource.S {{- if eq .Type "StringList"}} ElementType: types.StringType, {{- end}} - {{- if or .Id .Reference .Mandatory}} + {{- if or .Reference .Mandatory}} Required: true, {{- else}} Optional: true, @@ -161,7 +161,7 @@ func (r *{{camelCase .Name}}Resource) Schema(ctx context.Context, req resource.S {{- if eq .Type "StringList"}} ElementType: types.StringType, {{- end}} - {{- if or .Id .Reference .Mandatory}} + {{- if or .Reference .Mandatory}} Required: true, {{- else}} Optional: true, @@ -221,7 +221,7 @@ func (r *{{camelCase .Name}}Resource) Schema(ctx context.Context, req resource.S {{- if eq .Type "StringList"}} ElementType: types.StringType, {{- end}} - {{- if or .Id .Reference .Mandatory}} + {{- if or .Reference .Mandatory}} Required: true, {{- else}} Optional: true, @@ -281,7 +281,7 @@ func (r *{{camelCase .Name}}Resource) Schema(ctx context.Context, req resource.S {{- if eq .Type "StringList"}} ElementType: types.StringType, {{- end}} - {{- if or .Id .Reference .Mandatory}} + {{- if or .Reference .Mandatory}} Required: true, {{- else}} Optional: true, diff --git a/internal/provider/model_ise_device_admin_condition.go b/internal/provider/model_ise_device_admin_condition.go index 060d57c..1cb3e2b 100644 --- a/internal/provider/model_ise_device_admin_condition.go +++ b/internal/provider/model_ise_device_admin_condition.go @@ -22,7 +22,6 @@ package provider //template:begin imports import ( "context" - "strconv" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/tidwall/gjson" @@ -406,8 +405,8 @@ func (data *DeviceAdminCondition) updateFromBody(ctx context.Context, res gjson. data.Operator = types.StringNull() } for i := range data.Children { - keys := [...]string{"name", "description", "conditionType", "id", "isNegate", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} - keyValues := [...]string{data.Children[i].Name.ValueString(), data.Children[i].Description.ValueString(), data.Children[i].ConditionType.ValueString(), data.Children[i].Id.ValueString(), strconv.FormatBool(data.Children[i].IsNegate.ValueBool()), data.Children[i].AttributeName.ValueString(), data.Children[i].AttributeValue.ValueString(), data.Children[i].DictionaryName.ValueString(), data.Children[i].DictionaryValue.ValueString(), data.Children[i].Operator.ValueString()} + keys := [...]string{"name", "conditionType", "id", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} + keyValues := [...]string{data.Children[i].Name.ValueString(), data.Children[i].ConditionType.ValueString(), data.Children[i].Id.ValueString(), data.Children[i].AttributeName.ValueString(), data.Children[i].AttributeValue.ValueString(), data.Children[i].DictionaryName.ValueString(), data.Children[i].DictionaryValue.ValueString(), data.Children[i].Operator.ValueString()} var r gjson.Result res.Get("response.children").ForEach( @@ -479,8 +478,8 @@ func (data *DeviceAdminCondition) updateFromBody(ctx context.Context, res gjson. data.Children[i].Operator = types.StringNull() } for ci := range data.Children[i].Children { - keys := [...]string{"name", "description", "conditionType", "id", "isNegate", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} - keyValues := [...]string{data.Children[i].Children[ci].Name.ValueString(), data.Children[i].Children[ci].Description.ValueString(), data.Children[i].Children[ci].ConditionType.ValueString(), data.Children[i].Children[ci].Id.ValueString(), strconv.FormatBool(data.Children[i].Children[ci].IsNegate.ValueBool()), data.Children[i].Children[ci].AttributeName.ValueString(), data.Children[i].Children[ci].AttributeValue.ValueString(), data.Children[i].Children[ci].DictionaryName.ValueString(), data.Children[i].Children[ci].DictionaryValue.ValueString(), data.Children[i].Children[ci].Operator.ValueString()} + keys := [...]string{"name", "conditionType", "id", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} + keyValues := [...]string{data.Children[i].Children[ci].Name.ValueString(), data.Children[i].Children[ci].ConditionType.ValueString(), data.Children[i].Children[ci].Id.ValueString(), data.Children[i].Children[ci].AttributeName.ValueString(), data.Children[i].Children[ci].AttributeValue.ValueString(), data.Children[i].Children[ci].DictionaryName.ValueString(), data.Children[i].Children[ci].DictionaryValue.ValueString(), data.Children[i].Children[ci].Operator.ValueString()} var cr gjson.Result r.Get("children").ForEach( diff --git a/internal/provider/model_ise_network_access_condition.go b/internal/provider/model_ise_network_access_condition.go index 006188c..0efbea0 100644 --- a/internal/provider/model_ise_network_access_condition.go +++ b/internal/provider/model_ise_network_access_condition.go @@ -22,7 +22,6 @@ package provider //template:begin imports import ( "context" - "strconv" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/tidwall/gjson" @@ -406,8 +405,8 @@ func (data *NetworkAccessCondition) updateFromBody(ctx context.Context, res gjso data.Operator = types.StringNull() } for i := range data.Children { - keys := [...]string{"name", "description", "conditionType", "id", "isNegate", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} - keyValues := [...]string{data.Children[i].Name.ValueString(), data.Children[i].Description.ValueString(), data.Children[i].ConditionType.ValueString(), data.Children[i].Id.ValueString(), strconv.FormatBool(data.Children[i].IsNegate.ValueBool()), data.Children[i].AttributeName.ValueString(), data.Children[i].AttributeValue.ValueString(), data.Children[i].DictionaryName.ValueString(), data.Children[i].DictionaryValue.ValueString(), data.Children[i].Operator.ValueString()} + keys := [...]string{"name", "conditionType", "id", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} + keyValues := [...]string{data.Children[i].Name.ValueString(), data.Children[i].ConditionType.ValueString(), data.Children[i].Id.ValueString(), data.Children[i].AttributeName.ValueString(), data.Children[i].AttributeValue.ValueString(), data.Children[i].DictionaryName.ValueString(), data.Children[i].DictionaryValue.ValueString(), data.Children[i].Operator.ValueString()} var r gjson.Result res.Get("response.children").ForEach( @@ -479,8 +478,8 @@ func (data *NetworkAccessCondition) updateFromBody(ctx context.Context, res gjso data.Children[i].Operator = types.StringNull() } for ci := range data.Children[i].Children { - keys := [...]string{"name", "description", "conditionType", "id", "isNegate", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} - keyValues := [...]string{data.Children[i].Children[ci].Name.ValueString(), data.Children[i].Children[ci].Description.ValueString(), data.Children[i].Children[ci].ConditionType.ValueString(), data.Children[i].Children[ci].Id.ValueString(), strconv.FormatBool(data.Children[i].Children[ci].IsNegate.ValueBool()), data.Children[i].Children[ci].AttributeName.ValueString(), data.Children[i].Children[ci].AttributeValue.ValueString(), data.Children[i].Children[ci].DictionaryName.ValueString(), data.Children[i].Children[ci].DictionaryValue.ValueString(), data.Children[i].Children[ci].Operator.ValueString()} + keys := [...]string{"name", "conditionType", "id", "attributeName", "attributeValue", "dictionaryName", "dictionaryValue", "operator"} + keyValues := [...]string{data.Children[i].Children[ci].Name.ValueString(), data.Children[i].Children[ci].ConditionType.ValueString(), data.Children[i].Children[ci].Id.ValueString(), data.Children[i].Children[ci].AttributeName.ValueString(), data.Children[i].Children[ci].AttributeValue.ValueString(), data.Children[i].Children[ci].DictionaryName.ValueString(), data.Children[i].Children[ci].DictionaryValue.ValueString(), data.Children[i].Children[ci].Operator.ValueString()} var cr gjson.Result r.Get("children").ForEach( diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 9751507..813951a 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -10,6 +10,7 @@ description: |- ## 0.1.8 (unreleased) - Fix default value of `ip_version` attribute of `ise_trustsec_security_group_acl` resource +- Fix idempotency issue with `ise_network_access_condition` and `ise_device_admin_condition` resources ## 0.1.7