opentelekomcloud / terraform-provider-opentelekomcloud

Terraform OpenTelekomCloud provider
https://registry.terraform.io/providers/opentelekomcloud/opentelekomcloud/latest
Mozilla Public License 2.0
88 stars 77 forks source link

destroy success but the resource still exist #2714

Closed TTTouper closed 2 days ago

TTTouper commented 2 weeks ago

Terraform provider version

1.36.15

Affected Resource(s)

opentelekomcloud_vpc_v1 opentelekomcloud_vpc_subnet_v1

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
{
    "terraform": {
        "required_providers": {
            "opentelekomcloud": {
                "source": "opentelekomcloud/provider/opentelekomcloud",
                "version": "1.36.15"
            }
        }
    },
    "provider": {
        "opentelekomcloud": {
            "region": "eu-de",
            "insecure": true,
            "auth_url": "https://iam.eu-de.otctest.t-systems.com/v3",
            "tenant_name": "eu-de",
            "domain_name": "OTC-EU-DE-******************",
            "user_name": "*****",
        }
    },
    "variable": {
        "vpc_name_1": {
            "type": "string",
            "description": "vpc name_1",
            "default": "rfs__create_vpc__vpc_mrumpler_1",
            "nullable": false
        },
        "subnet_name_1": {
            "type": "string",
            "description": "subnet name_1",
            "default": "rfs__create_vpc__subnet_mrumpler_1"
        },
        "vpc_name_2": {
            "type": "string",
            "description": "vpc name_2",
            "default": "rfs__create_vpc__vpc_mrumpler_2",
            "nullable": false
        },
        "subnet_name_2": {
            "type": "string",
            "description": "subnet name_2",
            "default": "rfs__create_vpc__subnet_mrumpler_2"
        },
        "vpc_name_3": {
            "type": "string",
            "description": "vpc name_3",
            "default": "rfs__create_vpc__vpc_mrumpler_3",
            "nullable": false
        },
        "subnet_name_3": {
            "type": "string",
            "description": "subnet name_3",
            "default": "rfs__create_vpc__subnet_mrumpler_3"
        },
        "vpc_name_4": {
            "type": "string",
            "description": "vpc name_4",
            "default": "rfs__create_vpc__vpc_mrumpler_4",
            "nullable": false
        },
        "subnet_name_4": {
            "type": "string",
            "description": "subnet name_4",
            "default": "rfs__create_vpc__subnet_mrumpler_4"
        },
        "vpc_name_5": {
            "type": "string",
            "description": "vpc name_5",
            "default": "rfs__create_vpc__vpc_mrumpler_5",
            "nullable": false
        },
        "subnet_name_5": {
            "type": "string",
            "description": "subnet name_5",
            "default": "rfs__create_vpc__subnet_mrumpler_5"
        },
        "vpc_name_6": {
            "type": "string",
            "description": "vpc name_6",
            "default": "rfs__create_vpc__vpc_mrumpler_6",
            "nullable": false
        },
        "subnet_name_6": {
            "type": "string",
            "description": "subnet name_6",
            "default": "rfs__create_vpc__subnet_mrumpler_6"
        },
        "vpc_name_7": {
            "type": "string",
            "description": "vpc name_7",
            "default": "rfs__create_vpc__vpc_mrumpler_7",
            "nullable": false
        },
        "subnet_name_7": {
            "type": "string",
            "description": "subnet name_7",
            "default": "rfs__create_vpc__subnet_mrumpler_7"
        },
        "vpc_name_8": {
            "type": "string",
            "description": "vpc name_8",
            "default": "rfs__create_vpc__vpc_mrumpler_8",
            "nullable": false
        },
        "subnet_name_8": {
            "type": "string",
            "description": "subnet name_8",
            "default": "rfs__create_vpc__subnet_mrumpler_8"
        },
        "vpc_name_9": {
            "type": "string",
            "description": "vpc name_9",
            "default": "rfs__create_vpc__vpc_mrumpler_9",
            "nullable": false
        },
        "subnet_name_9": {
            "type": "string",
            "description": "subnet name_9",
            "default": "rfs__create_vpc__subnet_mrumpler_9"
        },
        "vpc_name_10": {
            "type": "string",
            "description": "vpc name_10",
            "default": "rfs__create_vpc__vpc_mrumpler_10",
            "nullable": false
        },
        "subnet_name_10": {
            "type": "string",
            "description": "subnet name_10",
            "default": "rfs__create_vpc__subnet_mrumpler_10"
        },
        "vpc_name_11": {
            "type": "string",
            "description": "vpc name_11",
            "default": "rfs__create_vpc__vpc_mrumpler_11",
            "nullable": false
        },
        "subnet_name_11": {
            "type": "string",
            "description": "subnet name_11",
            "default": "rfs__create_vpc__subnet_mrumpler_11"
        }
    },
    "resource": {
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_1": {
                "name": "${var.vpc_name_1}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_2": {
                "name": "${var.vpc_name_2}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_3": {
                "name": "${var.vpc_name_3}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_4": {
                "name": "${var.vpc_name_4}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_5": {
                "name": "${var.vpc_name_5}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_6": {
                "name": "${var.vpc_name_6}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_7": {
                "name": "${var.vpc_name_7}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_8": {
                "name": "${var.vpc_name_8}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_9": {
                "name": "${var.vpc_name_9}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_10": {
                "name": "${var.vpc_name_10}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_v1": {
            "rf_doc_vpc_11": {
                "name": "${var.vpc_name_11}",
                "cidr": "192.168.0.0/16"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_1": {
                "name": "${var.subnet_name_1}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_1.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_2": {
                "name": "${var.subnet_name_2}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_2.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_3": {
                "name": "${var.subnet_name_3}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_3.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_4": {
                "name": "${var.subnet_name_4}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_4.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_5": {
                "name": "${var.subnet_name_5}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_5.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_6": {
                "name": "${var.subnet_name_6}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_6.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_7": {
                "name": "${var.subnet_name_7}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_7.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_8": {
                "name": "${var.subnet_name_8}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_8.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_9": {
                "name": "${var.subnet_name_9}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_9.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_10": {
                "name": "${var.subnet_name_10}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_10.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        },
        "opentelekomcloud_vpc_subnet_v1": {
            "rf_doc_subnet_11": {
                "name": "${var.subnet_name_11}",
                "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc_11.id}",
                "cidr": "192.168.1.0/24",
                "gateway_ip": "192.168.1.1"
            }
        }
    },
    "output": {
        "vpc_id_1": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_1.id}",
            "description": "VPC_1 ID"
            },
        "vpc_id_2": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_2.id}",
            "description": "VPC_2 ID"
            },
        "vpc_id_3": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_3.id}",
            "description": "VPC_3 ID"
            },
        "vpc_id_4": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_4.id}",
            "description": "VPC_4 ID"
            },
        "vpc_id_5": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_5.id}",
            "description": "VPC_5 ID"
            },
        "vpc_id_6": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_6.id}",
            "description": "VPC_6 ID"
            },
        "vpc_id_7": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_7.id}",
            "description": "VPC_7 ID"
            },
        "vpc_id_8": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_8.id}",
            "description": "VPC_8 ID"
            },
        "vpc_id_9": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_9.id}",
            "description": "VPC_9 ID"
            },
        "vpc_id_10": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_10.id}",
            "description": "VPC_10 ID"
            },
        "vpc_id_11": {
            "value": "${opentelekomcloud_vpc_v1.rf_doc_vpc_11.id}",
            "description": "VPC_11 ID"
            },
        "subnet_id_1": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_1.id}",
            "description": "Subnet_1 ID"
            },
        "subnet_id_2": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_2.id}",
            "description": "Subnet_2 ID"
            },
        "subnet_id_3": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_3.id}",
            "description": "Subnet_3 ID"
            },
        "subnet_id_4": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_4.id}",
            "description": "Subnet_4 ID"
            },
        "subnet_id_5": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_5.id}",
            "description": "Subnet_5 ID"
            },
        "subnet_id_6": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_6.id}",
            "description": "Subnet_6 ID"
            },
        "subnet_id_7": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_7.id}",
            "description": "Subnet_7 ID"
            },
        "subnet_id_8": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_8.id}",
            "description": "Subnet_8 ID"
            },
        "subnet_id_9": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_9.id}",
            "description": "Subnet_9 ID"
            },
        "subnet_id_10": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_10.id}",
            "description": "Subnet_10 ID"
            },
        "subnet_id_11": {
            "value": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet_11.id}",
            "description": "Subnet_11 ID"
            }
    }
}

Debug Output/Panic Output

image

Steps to Reproduce

  1. terraform init
  2. terraform apply
  3. create ecs under vpc rfs__create_vpcvpcmrumpler3
  4. terraform destroy

Expected Behavior

destroy failed

Actual Behavior

image

but resource still exist

image

Important Factoids

References

artem-lifshits commented 1 week ago

Hello @TTTouper. I wasn't able to reproduce the issue, in my case subnet deletion goes into 'still destroying...' loop. Are you using some kind of module? Which region are you launching this config on?

TTTouper commented 1 week ago

Will it remain in the 'still destroying...' loop? What will the final state be? It’s in the OTC pre-prod environment

TTTouper commented 1 week ago

This issue occurred during resource destroy after the problem in Issue 2712 https://github.com/opentelekomcloud/terraform-provider-opentelekomcloud/issues/2712

artem-lifshits commented 1 week ago

The subnet destruction loop occurs when a resource tries to delete itself but cannot due to other related resources still being in use. In this case, an active ECS instance prevents the subnet from being deleted. While unbinding the ECS during deletion might resolve the issue, this isn't the correct approach when using Terraform. Resources created through Terraform configuration should not be manually modified via the console. Binding an ECS to a Terraform-managed subnet can lead to loops or inconsistencies with the Terraform configuration. All Terraform resources are based on documentation from the official portal. If the API contains bugs, they may be inherited by the Terraform provider. Some of these issues can be resolved programmatically on the Terraform side, while others cannot. The PreProd environment requires debugging and investigation efforts from our side and will likely uncover numerous discrepancies across different PreProd services. This requires significant effort and testing, involves many resources, and the Terraform development team lacks the bandwidth for such extensive testing. Therefore, please only open issues if you have encountered them in the production environment.

mrumpler3 commented 1 week ago

Hi @artem-lifshits ,

please stop saying "don't open tickets regarding PreProd environment".

The PREPROD environment is the quality gate of the OTC ecosystem, which ensures that our customers will receive high quality services. If you are willing to investigate only those issues which are coming from the production system, this would jeopardize the business of our customers and the OTC brand in the long run which may lead to serious financial consequences.

The strategy, what determined by the OTC Leadership, is clear: we must deliver top quality products to our customers. This is the highest priority, which can only be achieved if we perform proper testing in the PREPROD environment in order to eliminate as many problems as possible. Releasing products to customers, which contain several issues/problems, can lead to penalty and loss of reputation.

I hope, now you understand how important is this and why it is crucial to investigate and fix such issues, which occur in the PREPROD environment.

I expect full cooperation and support regarding the investigation of this issue from your side. I know that every team is heavily overloaded, but this cannot be the reason for ignoring such issues. Please reopen this ticket and help to figure out the root cause of this problem.

artem-lifshits commented 1 week ago

@mrumpler3 issue happens because of subnet management API, feel free to explore why it's not working on preprod.

mrumpler3 commented 1 week ago

Hi @artem-lifshits ,

so you says that the received log entry about the successfully completed subnet destruction (which did not happen in the reality) is coming from a subnet related API and Terraform has nothing to do with it.

Am I understand your statement correctly?

anton-sidelnikov commented 1 week ago

Hi @mrumpler3, could you please provide a more detailed description and a reproducible test case, including what you’ve done and what you’re aiming to achieve? Also, I noticed an issue where the Terraform state may be disrupted if changes are made manually in the cloud. It’s important to manage all resources through Terraform and avoid making manual adjustments.

mrumpler3 commented 1 week ago

Hi @anton-sidelnikov ,

you can find all the necessary information in the following bug ticket: [RFS][PREPROD] Auto-rollback does not operate properly in some edge cases

There are 2 problems:

The problem is not that either a resource creation or a destruction fails, this was the aim of the test and the expected outcome. The problem is that the result of the creation and the destruction was incorrectly identified.

anton-sidelnikov commented 1 week ago

Hi @mrumpler3, could you create account for me in preProd? Also good to have a call next week to discuss this RFS thing, could you arrange one?

mrumpler3 commented 1 week ago

Hi @anton-sidelnikov ,

of course, I will arrange a call for next week. I also sent you the account information you requested in Zulip.

anton-sidelnikov commented 2 days ago

Hi @mrumpler3 @TTTouper, i've added test results in JIRA ticket, this is not tf issue but RFS itself.

mrumpler3 commented 2 days ago

Hi @anton-sidelnikov , thank you very much for the support!