Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: file names with special chars #2217

Merged
merged 1 commit into from
Jun 15, 2024
Merged

Conversation

tenthirtyam
Copy link
Collaborator

Description

Updates r/file to ensure that incoming file names with special characters (+, specifically) retain their original name when uploaded so that the plan is consistent.

Testing

terraform apply -auto-approve          
data.vsphere_datacenter.datacenter: Reading...
data.vsphere_datacenter.datacenter: Read complete after 0s [id=datacenter-3]
data.vsphere_datastore.datastore: Reading...
data.vsphere_datastore.datastore: Read complete after 0s [id=datastore-18076]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # vsphere_file.iso will be created
  + resource "vsphere_file" "iso" {
      + create_directories = true
      + datacenter         = "m01-dc01"
      + datastore          = "local-ssd-01"
      + destination_file   = "test/test-1.0.0+1.iso"
      + id                 = (known after apply)
      + source_file        = "/Users/johnsonryan/Library/Mobile Documents/com~apple~CloudDocs/Code/Work/terrafom-examples-vmware/vsphere/vsphere-virtual-machine/clone-ovf-esxi-simple/test-1.0.0+1.iso"
    }

  # vsphere_file.isoa will be created
  + resource "vsphere_file" "isoa" {
      + create_directories = true
      + datacenter         = "m01-dc01"
      + datastore          = "local-ssd-01"
      + destination_file   = "test/test-2.0.0+2.iso"
      + id                 = (known after apply)
      + source_file        = "/Users/johnsonryan/Library/Mobile Documents/com~apple~CloudDocs/Code/Work/terrafom-examples-vmware/vsphere/vsphere-virtual-machine/clone-ovf-esxi-simple/test-2.0.0.iso"
    }

Plan: 2 to add, 0 to change, 0 to destroy.
vsphere_file.isoa: Creating...
vsphere_file.iso: Creating...
vsphere_file.iso: Creation complete after 0s [id=[local-ssd-01] m01-dc01/test/test-1.0.0+1.iso]
vsphere_file.isoa: Creation complete after 0s [id=[local-ssd-01] m01-dc01/test/test-2.0.0+2.iso]

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

terrafom-examples-vmware/vsphere/vsphere-virtual-machine/clone-ovf-esxi-simple on  main [✘!?] took 3.3s terraform destroy -auto-approve        
data.vsphere_datacenter.datacenter: Reading...
data.vsphere_datacenter.datacenter: Read complete after 0s [id=datacenter-3]
data.vsphere_datastore.datastore: Reading...
data.vsphere_datastore.datastore: Read complete after 1s [id=datastore-18076]
vsphere_file.iso: Refreshing state... [id=[local-ssd-01] m01-dc01/test/test-1.0.0+1.iso]
vsphere_file.isoa: Refreshing state... [id=[local-ssd-01] m01-dc01/test/test-2.0.0+2.iso]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # vsphere_file.iso will be destroyed
  - resource "vsphere_file" "iso" {
      - create_directories = true -> null
      - datacenter         = "m01-dc01" -> null
      - datastore          = "local-ssd-01" -> null
      - destination_file   = "test/test-1.0.0+1.iso" -> null
      - id                 = "[local-ssd-01] m01-dc01/test/test-1.0.0+1.iso" -> null
      - source_file        = "/Users/johnsonryan/Library/Mobile Documents/com~apple~CloudDocs/Code/Work/terrafom-examples-vmware/vsphere/vsphere-virtual-machine/clone-ovf-esxi-simple/test-1.0.0+1.iso" -> null
    }

  # vsphere_file.isoa will be destroyed
  - resource "vsphere_file" "isoa" {
      - create_directories = true -> null
      - datacenter         = "m01-dc01" -> null
      - datastore          = "local-ssd-01" -> null
      - destination_file   = "test/test-2.0.0+2.iso" -> null
      - id                 = "[local-ssd-01] m01-dc01/test/test-2.0.0+2.iso" -> null
      - source_file        = "/Users/johnsonryan/Library/Mobile Documents/com~apple~CloudDocs/Code/Work/terrafom-examples-vmware/vsphere/vsphere-virtual-machine/clone-ovf-esxi-simple/test-2.0.0.iso" -> null
    }

Plan: 0 to add, 0 to change, 2 to destroy.
vsphere_file.iso: Destroying... [id=[local-ssd-01] m01-dc01/test/test-1.0.0+1.iso]
vsphere_file.isoa: Destroying... [id=[local-ssd-01] m01-dc01/test/test-2.0.0+2.iso]
vsphere_file.isoa: Destruction complete after 1s
vsphere_file.iso: Destruction complete after 1s

Destroy complete! Resources: 2 destroyed.

image

Reference

Closes #1928

@tenthirtyam tenthirtyam added the bug Type: Bug label Jun 14, 2024
@tenthirtyam tenthirtyam added this to the v2.8.2 milestone Jun 14, 2024
@tenthirtyam tenthirtyam self-assigned this Jun 14, 2024
@tenthirtyam tenthirtyam requested a review from a team as a code owner June 14, 2024 22:16
@github-actions github-actions bot added provider Type: Provider needs-review Status: Pull Request Needs Review labels Jun 14, 2024
Updates `r/file` to ensure that incoming file names with special characters (+, specifically) retain their original name when uploaded so that the plan is consistent.

Ref: #1928

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
@tenthirtyam tenthirtyam force-pushed the fix/file-names-special-chars branch from 37a796e to 9d6846f Compare June 15, 2024 15:23
@tenthirtyam tenthirtyam merged commit 69ec14e into main Jun 15, 2024
5 checks passed
@tenthirtyam tenthirtyam deleted the fix/file-names-special-chars branch June 15, 2024 15:24
Copy link

This functionality has been released in v2.8.2 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Jun 29, 2024
@tenthirtyam tenthirtyam removed the needs-review Status: Pull Request Needs Review label Aug 14, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Type: Bug provider Type: Provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File upload to datastore changes "+" symbol in the file name to a space.
2 participants