Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

NoPermission - vsphere_folder.folder: cannot find datacenter from path #803

Closed
tonywadeza opened this issue Jul 4, 2019 · 4 comments
Closed

Comments

@tonywadeza
Copy link

  • vsphere_folder.folder: cannot find datacenter from path "/STR": NoPermission

Occurs when the root folder has multiple datacenters and vsphere credential can read and see all datacenters

Terraform Version

Terraform v0.11.13

Affected Resource(s)

terraform-provider-vsphere

Terraform Configuration Files

# Variables
variable "vcenter_user" {
  type = "string"
}

variable "vcenter_password" {
  type = "string"
}

variable "vcenter_server" {
  type = "string"
}

variable "vsphere_datacenter" {
  type = "string"
}

variable "vsphere_cluster" {
  type = "string"
  default = ""
}

variable "vsphere_folder" {
  type = "string"
}

#Data Source
data "vsphere_datacenter" "dc" {
  name = "${var.vsphere_datacenter}"
}

# Provider
provider "vsphere" {
  version        = "~> 1.8"
  user           = "${var.vcenter_user}"
  password       = "${var.vcenter_password}"
  vsphere_server = "${var.vcenter_server}"
  allow_unverified_ssl = true
  }

# Create a folder
resource "vsphere_folder" "folder" {
  path          = "${var.vsphere_folder}"
  type          = "vm"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

Debug Output
https://gist.github.com/tonywadeza/a31136090ed0c8a97fa3ddc4dd3423f0

Expected Behavior
The vsphere_folder resource should be created successfully.

Actual Behavior
The vsphere_folder resource was created. And "NoPermission" reported on the console. Further to this, the removal of the folder using destroy does not work as the terraform state does not have the folder as a valid resource.

Steps to Reproduce
Please list the steps required to reproduce the issue, for example:

  1. terraform apply
@tonywadeza
Copy link
Author

It would appear the the above may be due to insufficient permissions to query the Datacenter Info. The output on a smaller cluster with a single DC:

govc datacenter.info
Name: LAB
Path: /LAB
Hosts: 7
Clusters: 2
Virtual Machines: 4
Networks: 17
Datastores: 35

v.s

govc datacenter.info
govc: NoPermission

Now to find what permission is needed to correct this.

@tonywadeza
Copy link
Author

VM Administrators have added my account with Full permissions. Issue resolved.

@danielkucera
Copy link

I have the same issue:

vsphere_folder.folder: Creating...

Error: cannot find datacenter from path "/Energy": NoPermission

  on new-vm.tf line 34, in resource "vsphere_folder" "folder":
  34: resource "vsphere_folder" "folder" {

While I can access the datacenter and create subfolders via vCenter without any problems.

@tonywadeza
Copy link
Author

terraform from what I understand makes use of the govmomi api's, and needs to be able at a minimum run the "govc datacenter.info"

If you are not able to get a response, then the above error occurs. Your access in vSphere needs to be from / (or the highest level of the vCenter Cluster)

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants