terraform-provider-vsphere: `r/virtual_machine`: unmodified annotation as heredoc triggers update across applies
Community Guidelines
- I have read and agree to the HashiCorp Community Guidelines .
- Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
- Do not leave “+1” or other comments that do not add relevant information or questions.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Terraform
1.9.5
Terraform Provider
2.8.3
VMware vSphere
7.0.3 build 22357613
Description
When a multi-line virtual machine annotation is specified using a heredoc (using <<-EOT) it is correctly saved through vSphere provider, but subsequent applies of the same unmodified annotation shows changes are detected. The changes detected are apparently phantom, showing per-line changes from -value to +value in plan/apply output with the line content shown is clearly unmodified.
When the multi-line annotation is specified as a single string with inline C-style escaped line-endings (e.g.: “my multi-line\nawesome\n\nannotation”), the problem does not exist. The multi-line annotation is saved and appears as intended, and subsequent plan/apply invocations detect no changes.
Affected Resources or Data Sources
resource/vsphere_virtual_machine
Terraform Configuration
Example annotation demonstrating issue, lines are TAB-prefixed:
annotation = <<-EOT
my multi-line
awesome
annotation
EOT
Example annotation that avoids issue:
annotation = "my multi-line\nawesome\n\nannotation"
Debug Output
https://gist.github.com/arcticgeek/9c14ec830118c2a2aabb2714dcd693e9
Panic Output
No response
Expected Behavior
Multi-line VM annotations specified as heredocs should trigger no changes when unmodified across plan/apply invocations.
Actual Behavior
Phantom changes to the multi-line annotation are detected even when unmodified.
Steps to Reproduce
- apply multi-line annotation to VM resource as heredoc with
<<-EOT. - Run
terraform plan|apply
Environment Details
Windows AMD64 with terraform source code in UTF8 and having CRLF line endings.
Screenshots
No response
References
https://github.com/hashicorp/terraform-provider-vsphere/issues/713
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 18 (9 by maintainers)
Commits related to this issue
- fix: normalize annotation for diff suppression Adds a `DiffSuppressFunc` for the `annotation`attribute. The function utilizes a new helper, `virtualmachine.NormalizeAnnotation`, to standardize newlin... — committed to vmware/terraform-provider-vsphere by tenthirtyam 2 years ago
- fix: normalize annotation for diff suppression Adds a `DiffSuppressFunc` for the `annotation`attribute. The function utilizes a new helper, `virtualmachine.NormalizeAnnotation`, to standardize newlin... — committed to vmware/terraform-provider-vsphere by tenthirtyam 2 years ago
- fix: normalize annotation for diff suppression Adds a `DiffSuppressFunc` for the `annotation`attribute. The function utilizes a new helper, `virtualmachine.NormalizeAnnotation`, to standardize newlin... — committed to vmware/terraform-provider-vsphere by tenthirtyam 2 years ago
- fix: normalize annotation for diff suppression Adds a `DiffSuppressFunc` for the `annotation`attribute. The function utilizes a new helper, `virtualmachine.NormalizeAnnotation`, to standardize newlin... — committed to vmware/terraform-provider-vsphere by tenthirtyam 2 years ago
- fix: normalize annotation for diff suppression Adds a `DiffSuppressFunc` for the `annotation`attribute. The function utilizes a new helper, `virtualmachine.NormalizeAnnotation`, to standardize newlin... — committed to vmware/terraform-provider-vsphere by tenthirtyam 2 years ago
- fix: normalize annotation for diff suppression Adds a `DiffSuppressFunc` for the `annotation`attribute. The function utilizes a new helper, `virtualmachine.NormalizeAnnotation`, to standardize newlin... — committed to vmware/terraform-provider-vsphere by tenthirtyam 2 years ago
- fix: normalize annotation for diff suppression Adds a `DiffSuppressFunc` for the `annotation`attribute. The function utilizes a new helper, `virtualmachine.NormalizeAnnotation`, to standardize newlin... — committed to vmware/terraform-provider-vsphere by tenthirtyam 2 years ago
I’ve also tested this by editing this configuration in
Notepadto remove any automated formatting with my editor which had the same results.