outscale / terraform-provider-outscale

Mozilla Public License 2.0
28 stars 31 forks source link

Impossible to detect SG manually configure when the creation of a new plan #412

Closed sylvain987 closed 4 months ago

sylvain987 commented 5 months ago

Terraform Version

Terraform v1.6.2
on linux_amd64
+ provider registry.terraform.io/hashicorp/local v2.4.0
+ provider registry.terraform.io/hashicorp/outscale v0.10.0
+ provider registry.terraform.io/hashicorp/vault v3.22.0

Terraform Configuration Files

resource "outscale_nic" "NIC-VM" {

    subnet_id          = "subnet-4f81c3eb"
    security_group_ids = ["sg-02bda794"]

}

resource "outscale_vm" "VM-AFD" {

    vm_initiated_shutdown_behavior = "stop"
    image_id                       = "ami-2361d881"
    performance                    = "high"
    vm_type                        = "tinav5.c2r4p2"
    nics {
        nic_id                     = outscale_nic.NIC-VM.nic_id
        device_number              = "0"
    }
    keypair_name                   = "KEY-PRV-LINUX"
    block_device_mappings {
        device_name                = "/dev/sda1"
        bsu {
            volume_size            = "30"
            volume_type            = "gp2"
            delete_on_vm_deletion  = true
        }
    }
    tags {
          key   = "Name"
          value = "test-sg"
    }

}

Debug Output

Crash Output

Expected Behavior

When we add a security group manually, Terraform should ask to delete it when we recreate the plan

Actual Behavior

Actually, when we add a security group manually, Terraform do not see the change when we recreate the plan. But we can see the new SG on the state ...

Steps to Reproduce

terraform init -plugin-dir=/opt/terraform/plugins terraform plan -out=main.tfplan terraform apply "main.tfplan" Add SG manually through Cockpit on the created VM terraform plan -out=main.tfplan => Terraform do not see the new SG (it should ask to delete it because the SG is not on the configuration) terraform show => Terraform see the new SG only on the state

Additional Context

References

outscale-toa commented 5 months ago

Hi @sylvain987,

Thanks for reaching us, we are looking at your issue

Best regards,

outscale-toa commented 4 months ago

Merge in #409