outscale / terraform-provider-outscale

Mozilla Public License 2.0
28 stars 31 forks source link

outscale_nic missing expected bracket on 1.0.0 #459

Closed silex27 closed 5 days ago

silex27 commented 6 days ago

Terraform Version

Terraform v1.9.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/local v2.5.1
+ provider registry.terraform.io/hashicorp/vault v4.3.0
+ provider registry.terraform.io/outscale/outscale v1.0.0-rc.1

Terraform Configuration Files

#
# Network interfaces 
#
resource "outscale_nic" "nic_outscale" {
  for_each  = local.vm_map
  subnet_id = data.outscale_subnet.vpc_subnet.subnet_id

  security_group_ids = local.sg_map_by_vm[each.key]
  private_ips {
    is_primary = true
    private_ip = each.value.vm_details.private_ip
  }

  tags {
    key   = "name"
    value = "${local.prefix}-${each.key}-NIC"
  }
}

#
# Extra Network interfaces 
#
resource "outscale_nic" "extra_nic_outscale" {
  for_each  = local.extra_nic_map
  subnet_id = data.outscale_subnet.vpc_subnet.subnet_id
  security_group_ids = local.extra_nic_sg_map[each.key]

  private_ips {
    is_primary = true
    private_ip = each.value.private_ip
  }

  tags {
    key   = "name"
    value = "${each.key}"
  }
}

Debug Output

│ Error: missing expected [
│ 
│   with module.outscale_module.outscale_nic.nic_outscale["testing-terraform-1.0osc"],
│   on .terraform/modules/outscale_module/networks.tf line 39, in resource "outscale_nic" "nic_outscale":
│   39: resource "outscale_nic" "nic_outscale" {

Expected Behavior

Terraform plan ends succesfully.

Actual Behavior

After going from outscale-dev/outscale v0.5.3 to 1.0.0 , im not able to run my code against existing instances. Above code work perfectly with 0.5.3, I can create instance and run terraform again and again. But if I use the 1.0.0 version and the VM was previously created with 0.5.3, I get the attached error.

IF I create the instance with 1.0.0, the issue not happening.

What shoud I do ? I dont see changes between versions in documentation : https://registry.terraform.io/providers/outscale/outscale/0.8.2/docs/resources/nic (oldest available on site) https://registry.terraform.io/providers/outscale/outscale/1.0.0-rc.1/docs/resources/nic

outscale-rce commented 6 days ago

Can you confirm you upgraded to v1 correctly ? Some block types changed in terraform state and configuration files. Please refer to the migration part of the README

silex27 commented 5 days ago

Thank you ! In fact, i missed the sed's. My bad.