Closed ArnaultMICHEL closed 5 months ago
Hi @ArnaultMICHEL, Thanks for reaching us, we are looking at your issue.
Best regards,
Hi @ArnaultMICHEL, your workaround:
I found that it is working as expected using two `nics` instead of `primary_nic` + `nics` :
resource "outscale_vm" "myvm" {
...
nics {
nic_id = outscale_nic.myvm_nic01.nic_id
device_number = "0"
}
nics {
nic_id = outscale_nic.myvm_nic02.nic_id
device_number = "1"
}
...
}
It will work until adding an other nic through resource "outscale_nic_link"
#376
I advise you to use:
...
resource "outscale_vm" "myvm" {
...
primary_nic {
nic_id = outscale_nic.myvm_nic01.nic_id
device_number = "0"
}
...
}
...
resource "outscale_nic_link" "nic_link01" {
device_number = "1"
vm_id = outscale_vm.myvm.vm_id
nic_id = outscale_nic.myvm_nic02.nic_id
}
We will fix this issues soon
Best regards,
in my use case, i want to be 100% sure that the two NICs exists during the first boot of the OS (& cloudinit configuration operations).
So, from my understanding, this is how terraform manage dependencies with resources outscale_vm
+ outscale_nic_link
(from your advise) :
outscale_vm
(otherwize outscale_vm.myvm.vm_id
is not available)So when you use outscale_nic_link
, the attachment could be processed after the VM boot, especially if you have a large number of resources managed by terraform. if it happen after cloudinit network configuration step, the interface won't be properly configured by cloudinit.
I simply want to avoid that and don't use outscale_nic_link
FYI, we faced a similar issue with disk/volume ressource, when we populate a large number of VMs and volumes.
sometimes (~20% to 30% of our VMs), the volume is attached after cloudinit disk managment step.
so the volume is not properly configured (FS formatting + add to /etc/fstab
).
Fixed in v0.12.0
Terraform Version
Terraform Configuration Files
Output
the first
terraform apply
will create the VM. But the nextterraform apply
with the same terraform code will replaced the VM.Expected Behavior
I suggest two ways to fix it :
terraform apply
if mixingprimary_nic
withnics
nics
blocks if a VM has multiple NICS ( and removeprimary_nic
block?)Adding a code sample for "Create a VM with two NIC" in the documentation would be great +1
Actual Behavior
Will replace (destroy & recreate) the VM on each
terraform apply
, even if the terraform code didn't changeSteps to Reproduce
terraform init
terraform apply
-> the vm will be created :ok:terraform apply
-> :warning: the vm will be systematically replaced :warning:Workaround
I found that it is working as expected using two
nics
instead ofprimary_nic
+nics
:Documentation
the documentation for outscale provider invite the user/devops to use
primary_nic
withnics
: nics - (Optional) One or more NICs. If you specify this parameter, you must not specify the subnet_id and subregion_name parameters. To define a NIC as the primary network interface of the VM, use the primary_nic argument.Complete terraform code to reproduce
load your secrets in env vars
the apply the following main.tf file