dalet-oss / terraform-provider-opnsense

Terraform Provider for OPNSense DHCP Leases
Apache License 2.0
34 stars 6 forks source link

Allow parallelism #3

Open heitmanr opened 2 years ago

heitmanr commented 2 years ago

System Information

I'm using a terraform-module:

This VM uses dynamic/DHCP for it's management-IP.

So your module seems to be perfect to pre-populate my OPNSense-Lab-Firewall with DHCP and DNS entries.

If I use the module twice, for two VM-instances, it breaks...

for example

c:\ terraform apply
...
╷
│ Error: mapping doesn't exists for this MAC address
│
│   with module.vcenter-v.opnsense_dhcp_static_map.vcsa-dhcp,
│   on ..\#modules\vsphere-vcenter\42-vcenter-static-dhcp-ip.tf line 8, in resource "opnsense_dhcp_static_map" "vcsa-dhcp":
│    8: resource "opnsense_dhcp_static_map" "vcsa-dhcp" {
│
╵
╷
│ Error: host override entry doesn't exists
│
│   with module.vcenter-v.opnsense_dns_host_override.vcsa-dns,
│   on ..\#modules\vsphere-vcenter\42-vcenter-static-dhcp-ip.tf line 15, in resource "opnsense_dns_host_override" "vcsa-dns":
│   15: resource "opnsense_dns_host_override" "vcsa-dns" {
│
╵
╷
│ Error: host override entry doesn't exists
│
│   with module.vcenter-t.opnsense_dns_host_override.vcsa-dns,
│   on ..\#modules\vsphere-vcenter\42-vcenter-static-dhcp-ip.tf line 15, in resource "opnsense_dns_host_override" "vcsa-dns":
│   15: resource "opnsense_dns_host_override" "vcsa-dns" {
│
╵

Sometimes, DHCP and/or DNS-Entries get created, so after a dozen "terraform apply"-rounds all entries are there.

Since both modules get created in parallel:

Sometimes, it seems to end in an infinite loop:

c:\ terraform apply
...
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [20s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [30s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [40s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [50s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [1m0s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [1m10s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [1m20s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [1m30s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [1m40s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [1m50s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [2m0s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [2m10s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [2m20s elapsed]
module.vcenter-v.opnsense_dns_host_override.vcsa-dns: Still creating... [2m30s elapsed]
Stopping operation...

Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...

Two interrupts received. Exiting immediately. Note that data loss may have occurred.

╷
│ Error: operation canceled