{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/18280","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/18280/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/18280/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/18280/events","html_url":"https://github.com/hashicorp/terraform/issues/18280","id":333413027,"node_id":"MDU6SXNzdWUzMzM0MTMwMjc=","number":18280,"title":"VPC import provider alias","user":{"login":"egustafsson","id":40369806,"node_id":"MDQ6VXNlcjQwMzY5ODA2","avatar_url":"https://avatars2.githubusercontent.com/u/40369806?v=4","gravatar_id":"","url":"https://api.github.com/users/egustafsson","html_url":"https://github.com/egustafsson","followers_url":"https://api.github.com/users/egustafsson/followers","following_url":"https://api.github.com/users/egustafsson/following{/other_user}","gists_url":"https://api.github.com/users/egustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/egustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egustafsson/subscriptions","organizations_url":"https://api.github.com/users/egustafsson/orgs","repos_url":"https://api.github.com/users/egustafsson/repos","events_url":"https://api.github.com/users/egustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/egustafsson/received_events","type":"User","site_admin":false},"labels":[{"id":120957393,"node_id":"MDU6TGFiZWwxMjA5NTczOTM=","url":"https://api.github.com/repos/hashicorp/terraform/labels/waiting-response","name":"waiting-response","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-18T19:57:53Z","updated_at":"2018-06-18T22:39:16Z","closed_at":null,"author_association":"NONE","body":"### Terraform Version\r\n\r\n```\r\nTerraform v0.11.7\r\n+ provider.aws v1.21.0\r\n```\r\n\r\n### Terraform Configuration Files\r\n<!--\r\nPaste the relevant parts of your Terraform configuration between the ``` marks below.\r\n\r\nFor 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.\r\n-->\r\n\r\n```\r\nprovider \"aws\" {\r\n  alias = \"oregon\"\r\n  region     = \"us-west-2\"\r\n}\r\n\r\nresource \"aws_vpc\" \"devvpc\" {\r\n  provider   = \"aws.oregon\"\r\n  cidr_block = \"172.31.0.0/16\"\r\n\r\n  tags = {\r\n    Environment = \"Development\"\r\n  }\r\n\r\n}\r\n```\r\n\r\n### Debug Output\r\n<!--\r\nFull debug output can be obtained by running Terraform with the environment variable `TF_LOG=trace`. Please create a GitHub Gist containing the debug output. Please do _not_ paste the debug output in the issue, since debug output is long.\r\n\r\nDebug output may contain sensitive information. Please review it before posting publicly, and if you are concerned feel free to encrypt the files using the HashiCorp security public key.\r\n-->\r\n\r\n### Crash Output\r\n```\r\n$terraform import  aws_vpc.devvpc vpc-xxxxxx\r\naws_vpc.devvpc: Importing from ID \"vpc-xxxxxx\"...\r\naws_vpc.devvpc: Import complete!\r\n  Imported aws_vpc (ID: vpc-xxxxxx)\r\naws_vpc.devvpc: Refreshing state... (ID: vpc-xxxxxx)\r\n\r\nError: aws_vpc.devvpc (import id: vpc-xxxxxx): 1 error(s) occurred:\r\n\r\n* import aws_vpc.devvpc result: vpc-xxxxxx: import aws_vpc.devvpc (id: vpc-xxxxxx): Terraform detected a resource with this ID doesn't\r\nexist. Please verify the ID is correct. You cannot import non-existent\r\nresources using Terraform import.\r\n```\r\n\r\n### Steps to Reproduce\r\n```\r\n$terraform init\r\n$teraform import aws_vpc.devvpc vpc-xxxxxx\r\n\r\n```\r\nTo solve this issue I had to change my main.tf to use us-west-2 change my vpc-peering.tf so the devvpc resource wasn't using the aliased provider. \r\n\r\nmain.tf\r\n```\r\nprovider \"aws\" {\r\n  region = \"us-west-2\"\r\n}\r\n```\r\nvpc-peering.tf\r\n```\r\nresource \"aws_vpc\" \"devvpc\" {\r\n//  provider   = \"aws.oregon\"\r\n  cidr_block = \"172.31.0.0/16\"\r\n\r\n  tags = {\r\n    Environment = \"Development\"\r\n  }\r\n}\r\n```\r\n\r\n```\r\n$ terraform import  aws_vpc.devvpc vpc-xxxxxx\r\naws_vpc.devvpc: Importing from ID \"vpc-xxxxxx\"...\r\naws_vpc.devvpc: Import complete!\r\n  Imported aws_vpc (ID: vpc-xxxxxx)\r\naws_vpc.devvpc: Refreshing state... (ID: vpc-xxxxxx)\r\n\r\nImport successful!\r\n```\r\n\r\nNow after that I had to edit the terraform.tfstate file and change \r\n                    \"provider\": \"provider.aws\"\r\n to \r\n                    \"provider\": \"provider.aws.oregon\"\r\nand change back my main.tf to have us-east-2 and set back provider = \"aws.oregon\" for my devvpc. \r\n\r\nNow when I run a terraform plan it successfully refreshing the state of my devvpc and does not try to destroy or change it. \r\n\r\nIt seems that aws_vpc import does not properly handle aliased aws providers. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/398217681","html_url":"https://github.com/hashicorp/terraform/issues/18280#issuecomment-398217681","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/18280","id":398217681,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODIxNzY4MQ==","user":{"login":"egustafsson","id":40369806,"node_id":"MDQ6VXNlcjQwMzY5ODA2","avatar_url":"https://avatars2.githubusercontent.com/u/40369806?v=4","gravatar_id":"","url":"https://api.github.com/users/egustafsson","html_url":"https://github.com/egustafsson","followers_url":"https://api.github.com/users/egustafsson/followers","following_url":"https://api.github.com/users/egustafsson/following{/other_user}","gists_url":"https://api.github.com/users/egustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/egustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egustafsson/subscriptions","organizations_url":"https://api.github.com/users/egustafsson/orgs","repos_url":"https://api.github.com/users/egustafsson/repos","events_url":"https://api.github.com/users/egustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/egustafsson/received_events","type":"User","site_admin":false},"created_at":"2018-06-18T22:39:15Z","updated_at":"2018-06-18T22:39:15Z","author_association":"NONE","body":"I will try,  I got 3 other vpcs that I need to import.\n\ndidn't see anything on the provider flag in import but might be my fault.\n\nOn Mon, Jun 18, 2018, 18:36 James Bardin <notifications@github.com> wrote:\n\n> Hi @egustafsson <https://github.com/egustafsson>,\n>\n> Sorry about the confusion here. The import command can't currently\n> determine the correct provider form the configuration, and you need to use\n> the -provider flag.\n>\n> Does it work if you run terraform import -provider aws.oregon\n> aws_vpc.devvpc vpc-xxxxxx?\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/hashicorp/terraform/issues/18280#issuecomment-398217024>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/Amf-joIrRAzWzGlZ5Mq3HscvHuvnuIgbks5t-CtxgaJpZM4UsYVT>\n> .\n>\n"}}
{"actor":{"display_login":"egustafsson"}}