You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After setting "use-public-bgp" to "true" within our DNS Server test. We expect to see the correct output within the console.
What actually happened?
The tf plan produces expected result. However, no change is made in the console. After tf deploy, the terraform state shows as "false" for the resource. Every subsequent tf plan execution shows a change on the resource amending the "false" default value to "true".
After looking at the SDK, the problem is how the SDK struct field names are mapped to the TF provider schema. Specifically, the problem is with the "CamelCaseToUnderscore" function, that runs within the "ResourceBuildStruct" function.
For example:
Within the SDK, in the AgentServer struct, the field name is "UsePublicBGP". After the CamelCaseToUnderscore function is executed it produces a result of "use_publicbgp". This does not match the expected value in the tf provider schema ("use_public_bgp"). This is why our configured value doesn't go any further and why we aren't seeing the expected result being produced in the thousandeyes console.
The CamelCaseToUnderscore function does not seem to handle struct field names where there are multiple capital case letters at the end of the field name.
Besides "UsePublicBGP", there are other examples of SDK struct field names which might cause the same problem:
For example:
"UseActiveFTP"
"UseNLTM"
"SSLVersionID"
Terraform code to reproduce the bug
resource"thousandeyes_agent_to_server""example_agent_to_server_test" {
test_name="Example Agent to Server test set from Terraform provider"interval=120alerts_enabled=falseuse_public_bgp=trueserver="www.thousandeyes.com"port=443agents {
agent_id=3# Singapore
}
}
Any additional comments or code?
Potential Solution Ideas
Within this repo:
Amend the problem schema field names
For example:
"use_public_bgp" -> "use_publicbgp"
"use_active_ftp" -> "use_activeftp"
"use_nltm" -> "usenltm"
"ssl_version_id" -> "ssl_versionid"
Refactor the CamelCaseToUnderscore function
Need to handle all of the problem struct field names coming in from the SDK with multiple capital case letters at the end of the name.
Within the SDK repo:
Amend the Struct field names
Amend all of the problem names, make multiple capital case letters into lower case.
For example: change "UsePublicBGP" to "UsePublicBgp"
Steps to reproduce the bug
Isolate the "CamelCaseToUnderscore" function to recreate what happens when the SDK struct field values are mapped to the provider schema.
You will see that some names won't match as expected.
The text was updated successfully, but these errors were encountered:
What versions are you using?
Currently 2.0.2
What did you expect to happen?
After setting "use-public-bgp" to "true" within our DNS Server test. We expect to see the correct output within the console.
What actually happened?
The tf plan produces expected result. However, no change is made in the console. After tf deploy, the terraform state shows as "false" for the resource. Every subsequent tf plan execution shows a change on the resource amending the "false" default value to "true".
After looking at the SDK, the problem is how the SDK struct field names are mapped to the TF provider schema.
Specifically, the problem is with the "CamelCaseToUnderscore" function, that runs within the "ResourceBuildStruct" function.
For example:
Within the SDK, in the AgentServer struct, the field name is "UsePublicBGP". After the CamelCaseToUnderscore function is executed it produces a result of "use_publicbgp". This does not match the expected value in the tf provider schema ("use_public_bgp"). This is why our configured value doesn't go any further and why we aren't seeing the expected result being produced in the thousandeyes console.
The CamelCaseToUnderscore function does not seem to handle struct field names where there are multiple capital case letters at the end of the field name.
Besides "UsePublicBGP", there are other examples of SDK struct field names which might cause the same problem:
For example:
Terraform code to reproduce the bug
Any additional comments or code?
Potential Solution Ideas
Within this repo:
Amend the problem schema field names
For example:
Refactor the CamelCaseToUnderscore function
Within the SDK repo:
Amend the Struct field names
Steps to reproduce the bug
Isolate the "CamelCaseToUnderscore" function to recreate what happens when the SDK struct field values are mapped to the provider schema.
You will see that some names won't match as expected.
The text was updated successfully, but these errors were encountered: