Migration to1.0.0-rc.1: outscale_net_peering and outscale_net_peering_acceptation errors
EAS-EasyStack opened this issue · 2 comments
EAS-EasyStack commented
Terraform Version
Terraform v1.9.3
on linux_amd64
+ provider registry.terraform.io/hashicorp/local v2.5.1
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/outscale/outscale v1.0.0-rc.1
Terraform Configuration Files
resource "outscale_net_peering" "VPC_TMP-VPC_DEVOPS" {
source_net_id = outscale_net.VPC_TMP.id
accepter_net_id = outscale_net.VPC_DEVOPS.id
tags {
key = "Name"
value = "PEERING_VPC_TMP-VPC_DEVOPS"
}
}
resource "outscale_net_peering_acceptation" "VPC_TMP-VPC_DEVOPS_ACCEPTATION" {
net_peering_id = outscale_net_peering.VPC_TMP-VPC_DEVOPS.net_peering_id
}
Debug Output
│ Warning: Failed to decode resource from state
│
│ Error decoding "outscale_net_peering.VPC_TMP-VPC_DEVOPS" from prior state: missing expected [
│ Warning: Failed to decode resource from state
│
│ Error decoding "outscale_net_peering_acceptation.VPC_TMP-VPC_DEVOPS_ACCEPTATION" from prior state: missing expected [
│ Error: missing expected [
│
│ with outscale_net_peering.VPC_TMP-VPC_DEVOPS,
│ on 13_peering_vpc_tmp.tf line 5, in resource "outscale_net_peering" "VPC_TMP-VPC_DEVOPS":
│ 5: resource "outscale_net_peering" "VPC_TMP-VPC_DEVOPS" {
Crash Output
NA
Expected Behavior
terraform refresh
is executed successfully
Actual Behavior
terraform refresh
is exiting with errors
Steps to Reproduce
- Update provider from 0.12.0 to 1.0.0-rc.1 in configuration file
- execute
terraform init -upgrade
- Edit terraform state and configuration files following the instructions from the repo
terraform refresh
Additional Context
I created some peering in a new VPC with provider version 1.0.0-rc.1 to compare those resources in the state files between 0.12.0 and 1.0.0-rc.1and some bloc in the new version are now list of dict instead of dict.
# Version 1.0.0-rc.1 state file
{
"mode": "managed",
"type": "outscale_net_peering",
"name": "NET2_TO_NET1",
"provider": "provider[\"registry.terraform.io/outscale/outscale\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"accepter_net": [
{
"account_id": "...",
"ip_range": "172.16.0.0/16",
"net_id": "vpc-df338b88"
}
],
"accepter_net_id": "vpc-df338b88",
"id": "pcx-9e5f959d",
"net_peering_id": "pcx-9e5f959d",
"request_id": null,
"source_net": [
{
"account_id": "...",
"ip_range": "172.17.0.0/16",
"net_id": "vpc-4350acd7"
}
],
"source_net_account_id": null,
"source_net_id": "vpc-4350acd7",
"state": [
{
"message": "Active",
"name": "active"
}
],
...
{
"mode": "managed",
"type": "outscale_net_peering_acceptation",
"name": "net_peering_acceptation01",
"provider": "provider[\"registry.terraform.io/outscale/outscale\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"accepter_net": [
{
"account_id": "...",
"ip_range": "172.16.0.0/16",
"net_id": "vpc-df338b88"
}
],
"accepter_net_id": "vpc-df338b88",
"id": "pcx-9e5f959d",
"net_peering_id": "pcx-9e5f959d",
"request_id": null,
"source_net": [
{
"account_id": "....",
"ip_range": "172.17.0.0/16",
"net_id": "vpc-4350acd7"
}
],
...
# Version 0.12.0 state file
{
"mode": "managed",
"type": "outscale_net_peering",
"name": "VPC_TMP-VPC_DEVOPS",
"provider": "provider[\"registry.terraform.io/outscale/outscale\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"accepter_net": {
"account_id": "...",
"ip_range": "10.0.0.0/16",
"net_id": "vpc-585c2bbf"
},
"accepter_net_id": "vpc-585c2bbf",
"id": "pcx-4be0af1c",
"net_peering_id": "pcx-4be0af1c",
"request_id": null,
"source_net": {
"account_id": "...",
"ip_range": "10.3.0.0/16",
"net_id": "vpc-e4ff9033"
},
"source_net_account_id": null,
"source_net_id": "vpc-e4ff9033",
"state": {
"message": "Active",
"name": "active"
},
...
{
"mode": "managed",
"type": "outscale_net_peering_acceptation",
"name": "VPC_TMP-VPC_DEVOPS_ACCEPTATION",
"provider": "provider[\"registry.terraform.io/outscale/outscale\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"accepter_net": {
"account_id": "...",
"ip_range": "10.0.0.0/16",
"net_id": "vpc-585c2bbf"
},
"accepter_net_id": "vpc-585c2bbf",
"id": "pcx-4be0af1c",
"net_peering_id": "pcx-4be0af1c",
"request_id": null,
"source_net": {
"account_id": "...",
"ip_range": "10.3.0.0/16",
"net_id": "vpc-e4ff9033"
},
"source_net_id": "vpc-e4ff9033",
"state": {
"message": "Active",
"name": "active"
},
...
outscale-rce commented
ok, try to run those:
sed -i='' '/"accepter_net": {/, /},/d' terraform.tfstate
sed -i='' '/"source_net": {/, /},/d' terraform.tfstate
sed -i='' '/"state": {/, /},/d' terraform.tfstate
Those are missing from instructions, we will fix the Readme, sorry about that.
Just let us know if everything is running OK after that.
EAS-EasyStack commented
Yes this solved the issue, thanks