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?

🌎 Terraform でAWSを触るための 最初の main.tf を作成する手順

Last updated at Posted at 2025-02-11

📌 main.tf とは?

Terraform では、リソース定義のメインとなるファイルを main.tf に記述します。

このファイルに、プロバイダーの設定やリソースの定義を記述し、Terraform に適用します。

📌 事前に準備するもの

AWSアカウント

AWSを利用するために AWSアカウント を作成しておきましょう。

Terraform

インストールしていない場合は以下を参考にインストールします。

AWS CLI

インストールしていない場合は以下を参考にインストールします。

VS Codeプラグイン

VSCodeを利用している方は HashiCorp Terraformというプラグインをインストールしましょう。

📌 main.tf を作成する手順

まず、新しいディレクトリを作成し、その中に main.tf を作成します。

mkdir sandbox-terraform
cd sandbox-terraform
touch main.tf

次に、main.tf に以下のような最小限の設定を記述します。

# AWS プロバイダーの設定
# Terraform が操作する AWS のリージョンを指定
provider "aws" {
  region = "ap-northeast-1" # 東京リージョン
}

📌 さいごに

この記事では main.tf というファイルを作成しただですが、これこそが Terraform の学習を始める 最初の一歩 です 💪

ここから一歩ずつ進めていきましょう、本当にお疲れ様でした 🎉

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?