Vsphere provider cannot get datacenter info

Hi, I’m trying to connect terraform to our vmware infra and I’m stuck at the very first step…!!
The following code seems to work fine

data "vsphere_datacenter" "dc" {
name = "OurDatacenter"
}

But once I try to use the result in the next step:

data "vsphere_datastore" "datastore" {
name          = "ourDatastore"
datacenter_id = "data.vsphere_datacenter.dc.id"
}

I get this error message:

Error: error loading cluster: cannot locate datacenter: could not find datacenter with id: data.vsphere_datacenter.dc.id: ServerFaultCode: The object ‘vim.Datacenter:data.vsphere_datacenter.dc.id’ has already been deleted or has not been completely created

trying to ouput step 1 actually returns nothing…

output "datacenterInfo" {
  value = data.vsphere_datacenter.dc.id
}

Any clue? terraform connect correctly with vSphere with the information supplied in the provider block(and I see the logon in vSphere events log.) so I have no idea what is going on

Here is a part of the debug log that seems to show all is going well, so I’m really stomped why the reference is failing afterward.

s2020/10/07 11:50:58 [TRACE] BuiltinEvalContext: Initialized "provider["registry.terraform.io/hashicorp/vsphere"]" provider for provider[“registry.terraform.io/hashicorp/vsphere”]
t2020/10/07 11:50:58 [TRACE] eval: terraform.EvalNoop
2020/10/07 11:50:58 [TRACE] eval: *terraform.EvalOpFilter
2020/10/07 11:50:58 [TRACE] eval: *terraform.EvalSequence
2020/10/07 11:50:58 [TRACE] eval: *terraform.EvalGetProvider
2020/10/07 11:50:58 [TRACE] eval: *terraform.EvalOpFilter
2020/10/07 11:50:58 [TRACE] eval: *terraform.EvalSequence
2020/10/07 11:50:58 [TRACE] eval: *terraform.EvalConfigProvider
2020/10/07 11:50:58 [TRACE] buildProviderConfig for provider[“registry.terraform.io/hashicorp/vsphere”]: using explicit config only
2020/10/07 11:50:58 [TRACE] GRPCProvider: GetSchema
2020-10-07T11:50:58.662-0400 [TRACE] plugin.stdio: waiting for stdio data
2020-10-07T11:50:58.669-0400 [WARN] plugin.stdio: received EOF, stopping recv loop: err=“rpc error: code = Unimplemented desc = unknown service plugin.GRPCStdio”
2020/10/07 11:50:58 [TRACE] No provider meta schema returned
2020/10/07 11:50:58 [TRACE] GRPCProvider: Configure
2020-10-07T11:50:58.692-0400 [DEBUG] plugin.terraform-provider-vsphere_v1.24.0_x4.exe: 2020/10/07 11:50:58 [DEBUG] Cached SOAP client session data not valid or persistence not enabled, new session necessary
2020-10-07T11:50:58.692-0400 [DEBUG] plugin.terraform-provider-vsphere_v1.24.0_x4.exe: 2020/10/07 11:50:58 [DEBUG] Creating new SOAP API session on endpoint atvcm001.intro.techno.local
o2020-10-07T11:50:58.978-0400 [DEBUG] plugin.terraform-provider-vsphere_v1.24.0_x4.exe: 2020/10/07 11:50:58 [DEBUG] SOAP API session creation successful
r2020-10-07T11:50:58.978-0400 [DEBUG] plugin.terraform-provider-vsphere_v1.24.0_x4.exe: 2020/10/07 11:50:58 [DEBUG] VMWare vSphere Client configured for URL: atvcm001.intro.techno.local
2020-10-07T11:50:58.984-0400 [DEBUG] plugin.terraform-provider-vsphere_v1.24.0_x4.exe: 2020/10/07 11:50:58 [DEBUG] Setting up REST client
2020-10-07T11:50:59.655-0400 [DEBUG] plugin.terraform-provider-vsphere_v1.24.0_x4.exe: 2020/10/07 11:50:59 [DEBUG] CIS REST client configuration successful
2020/10/07 11:50:59 [TRACE] eval: terraform.EvalNoop
2020/10/07 11:50:59 [TRACE] [walkPlan] Exiting eval tree: provider[“registry.terraform.io/hashicorp/vsphere”]
2020/10/07 11:50:59 [TRACE] vertex "provider["registry.terraform.io/hashicorp/vsphere"]": visit complete
2020/10/07 11:50:59 [TRACE] dag/walk: visiting “data.vsphere_datacenter.dc (expand)”
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc (expand)”: starting visit (*terraform.nodeExpandPlannableResource)
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc (expand)”: expanding dynamic subgraph
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc (expand)”: entering dynamic subgraph
2020/10/07 11:50:59 [TRACE] dag/walk: visiting “data.vsphere_datacenter.dc”
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc”: starting visit (*terraform.NodePlannableResource)
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc”: evaluating
2020/10/07 11:50:59 [TRACE] [walkPlan] Entering eval tree: data.vsphere_datacenter.dc
2020/10/07 11:50:59 [TRACE] eval: *terraform.EvalWriteResourceState
2020/10/07 11:50:59 [TRACE] [walkPlan] Exiting eval tree: data.vsphere_datacenter.dc
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc”: expanding dynamic subgraph
2020/10/07 11:50:59 [TRACE] Executing graph transform *terraform.ResourceCountTransformer
2020/10/07 11:50:59 [TRACE] ResourceCountTransformer: adding data.vsphere_datacenter.dc as *terraform.NodePlannableResourceInstance
2020/10/07 11:50:59 [TRACE] Completed graph transform *terraforam.ResourceCountTransformer with new graph:
data.vsphere_datacenter.dc - *terraform.NodePlannableResourceInstance
2020/10/07 11:50:59 [TRACE] Executing graph transform *terraform.TargetsTransformer
2020/10/07 11:50:59 [TRACE] Completed graph transform *terraform.TargetsTransformer (no changes)
2020/10/07 11:50:59 [TRACE] Executing graph transform *terraform.ReferenceTransformer
2020/10/07 11:50:59 [DEBUG] ReferenceTransformer: “data.vsphere_datacenter.dc” references:
2020/10/07 11:50:59 [TRACE] Completed graph transform *terraform.ReferenceTransformer (no changes)
2020/10/07 11:50:59 [TRACE] Executing graph transform *terraform.RootTransformer
2020/10/07 11:50:59 [TRACE] Completed graph transform *terraform.RootTransformer (no changes)
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc”: entering dynamic subgraph
2020/10/07 11:50:59 [TRACE] dag/walk: visiting “data.vsphere_datacenter.dc”
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc”: starting visit (*terraform.NodePlannableResourceInstance)
2020/10/07 11:50:59 [TRACE] vertex “data.vsphere_datacenter.dc”: evaluating
2020/10/07 11:50:59 [TRACE] [walkPlan] Entering eval tree: data.vsphere_datacenter.dc
2020/10/07 11:50:59 [TRACE] eval: *terraform.EvalSequence
2020/10/07 11:50:59 [TRACE] eval: *terraform.EvalGetProvider
2020/10/07 11:50:59 [TRACE] eval: *terraform.EvalReadState
2020/10/07 11:50:59 [TRACE] EvalReadState: reading state for data.vsphere_datacenter.dc
2020/10/07 11:50:59 [TRACE] eval: *terraform.EvalValidateSelfRef
2020/10/07 11:50:59 [TRACE] eval: *terraform.evalReadDataPlan
2020/10/07 11:50:59 [TRACE] evalRegadDataPlan: data.vsphere_datacenter.dc no change detected, using existing state
e2020/10/07 11:51:00 [TRACE] eval: *terraform.EvalWriteState
2020/10/07 11:51:00 [TRACE] EvalWriteState: writing current state object for data.vsphere_datacenter.dc
2020/10/07 11:51:00 [TRACE] eval: *terraform.EvalWriteDiff
2020/10/07 11:51:00 [TRACE] [walkPlan] Exiting eval tree: data.vsphere_datacenter.dc
2020/10/07 11:51:00 [TRACE] vertex “data.vsphere_datacenter.dc”: visit complete
2020/10/07 11:51:00 [TRACE] vertex “data.vsphere_datacenter.dc”: dynamic subgraph completed successfully
2020/10/07 11:51:00 [TRACE] vertex “data.vsphere_datacenter.dc”: visit complete
2020/10/07 11:51:00 [TRACE] vertex “data.vsphere_datacenter.dc (expand)”: dynamic subgraph completed successfully
2020/10/07 11:51:00 [TRACE] vertex “data.vsphere_datacenter.dc (expand)”: visit complete
2020/10/07 11:51:00 [TRACE] dag/walk: visiting “output.datacenterInfo (expand)”
2020/10/07 11:51:00 [TRACE] vertex “output.datacenterInfo (expand)”: starting visit (*terraform.nodeExpandOutput)
2020/10/07 11:51:00 [TRACE] vertex “output.datacenterInfo (expand)”: expanding dynamic subgraph
2020/10/07 11:51:00 [TRACE] Expanding output: adding output.datacenterInfo as *terraform.NodeApplyableOutput
2020/10/07 11:51:00 [TRACE] vertex “output.datacenterInfo (expand)”: entering dynamic subgraph
2020/10/07 11:51:00 [TRACE] dag/walk: visiting “output.datacenterInfo”
2020/10/07 11:51:00 [TRACE] vertex “output.datacenterInfo”: starting visit (*terraform.NodeApplyableOutput)
2020/10/07 11:51:00 [TRACE] vertex “output.datacenterInfo”: evaluating
2020/10/07 11:51:00 [TRACE] [walkPlan] Entering eval tree: output.datacenterInfo
2020/10/07 11:51:00 [TRACE] eval: *terraform.EvalSequence
2020/10/07 11:51:00 [TRACE] eval: *terraform.EvalOpFilter
2020/10/07 11:51:00 [TRACE] eval: *terraform.EvalWriteOutput
2020/10/07 11:51:00 [TRACE] EvalWriteOutput: Saving value for output.datacenterInfo in state
2020/10/07 11:51:00 [TRACE] EvalWriteOutput: Saving Create change for output.datacenterInfo in changeset
2020/10/07 11:51:00 [TRACE] [walkPlan] Exiting eval tree: output.datacen.
terInfo
2020/10/07 11:51:00 [TRACE] vertex “output.datacenterInfo”: visit complete