0
1

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 1 year has passed since last update.

【terraform】AWSコンソールで作成したsecurity group ruleをterraformのmodule管理下に置く

0
Last updated at Posted at 2025-06-12

概要

AWSコンソールで作成したセキュリティグループルールをimportする方法を記す

背景

AWSコンソールで作成したリソースをterraform管理下に置くべく、インポートすることになった。
importするコマンドが公式から割り出せなかったので、備忘録として記す

結論

以下コマンドでimportすることが出来た。

$ terraform import module.[module名].aws_security_group_rule.[security group名][count_number] sg-XXXXX_ingress_tcp_80_80_X.X.X.X/X

失敗原因

terraform管理のリソースでcountを使用していた為、count番号もimportコマンドとして含めるべきだった。

終わりに

どなたかのお役に立てれば幸いです。
最後までお読みいただきありがとうございました!

参考資料

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?