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

Update r/vsphere_file resource and docs #1590

Merged
merged 6 commits into from
Feb 23, 2022
Merged

Update r/vsphere_file resource and docs #1590

merged 6 commits into from
Feb 23, 2022

Conversation

tenthirtyam
Copy link
Collaborator

@tenthirtyam tenthirtyam commented Feb 16, 2022

Description

  • Updates the r/vsphere_file docs content and examples.
  • Removed the code to remove the temporary directory where the VMDK is uploaded as this is automatically deleted as part of the VMDK move.

Plan:

provider "vsphere" {
  vsphere_server       = var.vsphere_server
  user                 = var.vsphere_username
  password             = var.vsphere_password
  allow_unverified_ssl = var.vsphere_insecure
}

resource "vsphere_file" "upload" {
  datacenter         = "m01-dc01"
  datastore          = "local-hdd-01"
  source_file        = "/Users/johnsonryan/Downloads/VMware-Appliance-FaH_1.0.5.vmdk"
  destination_file   = "/muffin/VMware-Appliance-FaH_1.0.5.vmdk"
  create_directories = true
}

Apply:

% terraform apply -auto-approve  

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.upload will be created
  + resource "vsphere_file" "upload" {
      + create_directories = true
      + datacenter         = "m01-dc01"
      + datastore          = "local-hdd-01"
      + destination_file   = "/muffin/VMware-Appliance-FaH_1.0.5.vmdk"
      + id                 = (known after apply)
      + source_file        = "/Users/johnsonryan/Downloads/VMware-Appliance-FaH_1.0.5.vmdk"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
vsphere_file.upload: Creating...
vsphere_file.upload: Still creating... [10s elapsed]
vsphere_file.upload: Still creating... [20s elapsed]
vsphere_file.upload: Still creating... [30s elapsed]
vsphere_file.upload: Still creating... [40s elapsed]
vsphere_file.upload: Still creating... [50s elapsed]
vsphere_file.upload: Still creating... [1m0s elapsed]
vsphere_file.upload: Still creating... [1m10s elapsed]
vsphere_file.upload: Still creating... [1m20s elapsed]
vsphere_file.upload: Still creating... [1m30s elapsed]
vsphere_file.upload: Still creating... [1m40s elapsed]
vsphere_file.upload: Still creating... [1m50s elapsed]
vsphere_file.upload: Still creating... [2m0s elapsed]
vsphere_file.upload: Still creating... [2m10s elapsed]
vsphere_file.upload: Still creating... [2m20s elapsed]
vsphere_file.upload: Still creating... [2m30s elapsed]
vsphere_file.upload: Still creating... [2m40s elapsed]
vsphere_file.upload: Still creating... [2m50s elapsed]
vsphere_file.upload: Still creating... [3m0s elapsed]
vsphere_file.upload: Creation complete after 3m9s [id=[local-hdd-01] m01-dc01//muffin/VMware-Appliance-FaH_1.0.5.vmdk]

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

Destroy:

% terraform destroy -auto-approve
vsphere_file.upload: Refreshing state... [id=[local-hdd-01] m01-dc01//muffin/VMware-Appliance-FaH_1.0.5.vmdk]

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.upload will be destroyed
  - resource "vsphere_file" "upload" {
      - create_directories = true -> null
      - datacenter         = "m01-dc01" -> null
      - datastore          = "local-hdd-01" -> null
      - destination_file   = "/muffin/VMware-Appliance-FaH_1.0.5.vmdk" -> null
      - id                 = "[local-hdd-01] m01-dc01//muffin/VMware-Appliance-FaH_1.0.5.vmdk" -> null
      - source_file        = "/Users/johnsonryan/Downloads/VMware-Appliance-FaH_1.0.5.vmdk" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.
vsphere_file.upload: Destroying... [id=[local-hdd-01] m01-dc01//muffin/VMware-Appliance-FaH_1.0.5.vmdk]
vsphere_file.upload: Destruction complete after 0s

Destroy complete! Resources: 1 destroyed.

References

Closes #1587

- Updates the `r/vsphere_file` docs content and examples.
- Update the `r/vsphere_file` resource to set `create_directories` as true by default to ensure the directory is created if not present. #1587
- Removed the the code to remove the tenporary directory where the VMDK is uploaded as this is automatically deleted as part of the VMDK move.

Signed-off-by: Ryan Johnson <johnsonryan@vmware.com>
@tenthirtyam tenthirtyam added bug Type: Bug documentation Type: Documentation needs-review Status: Pull Request Needs Review labels Feb 16, 2022
@tenthirtyam tenthirtyam added this to the v2.1.0 milestone Feb 16, 2022
@tenthirtyam tenthirtyam requested a review from appilon February 16, 2022 23:23
@github-actions github-actions bot added provider Type: Provider size/m Relative Sizing: Medium labels Feb 16, 2022
@tenthirtyam tenthirtyam added the area/storage Area: Storage label Feb 22, 2022
vsphere/resource_vsphere_file.go Outdated Show resolved Hide resolved
Ryan Johnson added 2 commits February 22, 2022 18:23
 Update the `r/vsphere_file` resource to set `create_directories` as false by default. Original setting.
 Update the `r/vsphere_file` resource to set `create_directories` as false by default. Original setting.
@tenthirtyam tenthirtyam requested a review from appilon February 22, 2022 23:28
Copy link
Contributor

@appilon appilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small edits, otherwise LGTM assuming the deleted cleanup code is okay

vsphere/resource_vsphere_file.go Show resolved Hide resolved
website/docs/r/file.html.markdown Outdated Show resolved Hide resolved
website/docs/r/file.html.markdown Outdated Show resolved Hide resolved
website/docs/r/file.html.markdown Outdated Show resolved Hide resolved
Ryan Johnson and others added 3 commits February 22, 2022 21:17
Co-authored-by: appilon <apilon@hashicorp.com>
Co-authored-by: appilon <apilon@hashicorp.com>
Co-authored-by: appilon <apilon@hashicorp.com>
@tenthirtyam
Copy link
Collaborator Author

Recommend changes committed and question answered!

@appilon appilon merged commit f2bfaf4 into hashicorp:master Feb 23, 2022
@github-actions
Copy link

github-actions bot commented Mar 2, 2022

This functionality has been released in v2.1.0 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!

@tenthirtyam tenthirtyam deleted the gh-1587 branch March 7, 2022 10:45
@tenthirtyam tenthirtyam removed the needs-review Status: Pull Request Needs Review label Mar 24, 2022
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
area/storage Area: Storage bug Type: Bug documentation Type: Documentation provider Type: Provider size/m Relative Sizing: Medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to upload the vmdk file when the destination folder doesnt exist
2 participants