0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

terraformでstateを入れ替える

Posted at

ステートを消す

terraform state rm aws_vpc_peering_connection.connection-a

grepしてリソースが管理されているかまずチェック

terraform state list | grep xxx

ステートをインポート

terraform import aws_vpc_peering_connection.connection-a pcx-xxxxxxxxxxxxx

インポートする際には、リソースを定義しておく

resource "aws_vpc_peering_connection" "connection-a" {
  peer_vpc_id = data.aws_vpc.vpc.*.id[0]
  vpc_id      = aws_vpc.vamdemic-vpc.id

  tags = {
    Name = "vamdemic-and-xxx"
  }
}

インポートするだけなら、リソースの中身はいらない

resource "aws_vpc_peering_connection" "connection-a" {
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?