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

vcd_org_vdc and default_compute_policy_id : set default VM Placement Policy and VM Sizing Policy #1037

Closed
NonoCX opened this issue Mar 28, 2023 · 6 comments
Assignees

Comments

@NonoCX
Copy link

NonoCX commented Mar 28, 2023

Hello,

Terraform Version

Terraform v1.4.2
on linux_amd64
+ provider registry.terraform.io/vmware/vcd v3.8.2

Affected Resource(s)

  • vcd_org_vdc

Terraform Configuration Files

#> Datasources Provider
data "vcd_provider_vdc" "pvdc" {
  name = "GOLD"
}

# Datasources VM Placement
data "vcd_vm_placement_policy" "availability_zone_1" {
  name            = "availability_zone_1"
  provider_vdc_id = data.vcd_provider_vdc.pvdc.id
}
data "vcd_vm_placement_policy" "availability_zone_2" {
  name            = "availability_zone_2"
  provider_vdc_id = data.vcd_provider_vdc.pvdc.id
}

# Datasources VM Sizing
data "vcd_vm_sizing_policy" "sizing_micro" {
  name     = "sizing_micro"
}
data "vcd_vm_sizing_policy" "sizing_large" {
  name     = "sizing_large"
}

resource "vcd_org_vdc" "OrgVDC_1" {
  name        = "OrgVDC_1"
  description = "OrgVDC_1"
  org         = "OrgVDC_1"

  allocation_model  = "AllocationVApp"
  network_pool_name = "nPool"
  provider_vdc_name = "GOLD"
  # ...
  vm_placement_policy_ids  = [data.vcd_vm_placement_policy.availability_zone_1.id, data.vcd_vm_placement_policy.availability_zone_2.id]
  vm_sizing_policy_ids     = [data.vcd_vm_sizing_policy.sizing_micro.id, data.vcd_vm_sizing_policy.sizing_large.id]

  #> Set 2 default policies (one for the Placement Policy and one other for Sizing Policy), but it is not working because `default_compute_policy_id` is a string, not a set of ID. 
  default_compute_policy_id = [data.vcd_vm_placement_policy.availability_zone_1.id, data.vcd_vm_sizing_policy.sizing_micro.id]
}

Expected Behavior

We want to set both default VM Placement Policy and VM Sizing Policy when we create OrgVDC

Actual Behavior

We are just able to set default VM Placement Policy or VM Sizing Policy

Steps to Reproduce

  1. terraform apply

User Access rights

System Administrator

Important Factoids

VCD Version 10.3.2.19173133

@adezxc
Copy link

adezxc commented Mar 29, 2023

Hello @NonoCX,

Right now, VCD only allows for one default compute policy, either placement or sizing and we can't change this in the provider.

@Jackpoto
Copy link

Hello @adezxc,

It's weird because in the UI we can set this two differents parameters in default.
Both parameters are completely differents and I do not understand why we have to choose only one.

Regards

@adezxc
Copy link

adezxc commented Mar 29, 2023

I see. Could you provide the exact workflow you followed to do that? As I tried it myself and I can't choose a default for both sizing and placement policies.

@Jackpoto
Copy link

Hello,

Effectively you're right, I was thinking that I can set both parameters with default tag but in fact VCD just active one by default and desactivate the previous one withouyt any warning message !
So my bad you're right it's not possible.
We will ask directly to VMware why !

Thanks a lot !

@adezxc adezxc closed this as completed Mar 29, 2023
@Jackpoto
Copy link

The case is open to ask them why a such limitation on VM placement and VM Sizing policies !

@carmine73
Copy link

carmine73 commented Mar 1, 2024

I can create a vdc with no policies, in this case vcd create a system default sizing policy (the default_compute_policy_id is the id of this policy).
I'd like to have a vdc with 2 placement policies and the system default sizing policy, with default_compute_policy_id same as before.
The issue I have is that default_compute_policy_id cannot be null and I don't know how to set this to the system default.

As a workaround I created a dummy/empty vm sizing policy, I assign it to the vdc a set it as default, so I can add placement policies.
Any better idea?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants