<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Terraform | Men of Letters（メン・オブ・レターズ） &#8211; 論理的思考/業務改善/プログラミング</title>
	<atom:link href="https://laboratory.kazuuu.net/category/terraform/feed/" rel="self" type="application/rss+xml" />
	<link>https://laboratory.kazuuu.net</link>
	<description></description>
	<lastBuildDate>Wed, 20 Apr 2022 04:36:33 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://laboratory.kazuuu.net/wp-content/uploads/2021/02/cropped-L-32x32.png</url>
	<title>Terraform | Men of Letters（メン・オブ・レターズ） &#8211; 論理的思考/業務改善/プログラミング</title>
	<link>https://laboratory.kazuuu.net</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>Terraform等を用いてインフラストラクチャを破壊・削除する（Windows10）</title>
		<link>https://laboratory.kazuuu.net/destroy-or-remove-infrastructure-using-terraform-or-other-tools/</link>
					<comments>https://laboratory.kazuuu.net/destroy-or-remove-infrastructure-using-terraform-or-other-tools/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Wed, 20 Apr 2022 04:36:33 +0000</pubDate>
				<category><![CDATA[Amazon/AWS]]></category>
		<category><![CDATA[Terraform]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=12222</guid>

					<description><![CDATA[Terraform等を用いてインフラストラクチャを破壊・削除してみます（Windows10） この記事は、Terraform等を用いてインフラストラクチャを構築するという記事を公開しましたが、その続きとなり、EC2インス [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Terraform等を用いてインフラストラクチャを破壊・削除してみます（Windows10）</p>
<p>この記事は、<a href="https://laboratory.kazuuu.net/build-infrastructure-using-terraform-and-other-tools-windows-10">Terraform等を用いてインフラストラクチャを構築する</a>という記事を公開しましたが、その続きとなり、EC2インスタンスをプロビジョニング（利用可能な状態に準備）したものを破壊・削除を行います。</p>
<p>なお、インフラストラクチャを構築するためには、Terraform CLI、AWSCLI、AWSアカウントの取得と、AWSアカウントに関連したクレデンシャル（資格・認証情報）が必要になりますので、事前に取得などを行っておく必要があります。</p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">■EC2インスタンスをプロビジョニング（利用可能な状態に準備）したものを確認する</a></li><li><a href="#toc2" tabindex="0">■インフラストラクチャを破壊・削除する</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">■EC2インスタンスをプロビジョニング（利用可能な状態に準備）したものを確認する</span></h2>
<p>EC2インスタンスをプロビジョニング（利用可能な状態に準備）したものを破壊・削除する前に、AWSにログインし、「EC2」にアクセスします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345.png"><img decoding="async" class="alignnone size-medium wp-image-12209" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-300x128.png" alt="" width="300" height="128" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-300x128.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-1024x436.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-768x327.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345.png 1264w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>アクセス後、「EC2 ダッシュボード」をクリックし、ダッシュボードの右上にある地域・リージョンが表示されている箇所をクリックします。今回は、「米国西部（オレゴン）us-west-2」でEC2インスタンスを作成しているので、「us-west-2」を選択します。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1.png"><img decoding="async" class="alignnone size-medium wp-image-12210" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-300x161.png" alt="" width="300" height="161" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-300x161.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-1024x549.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-768x412.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>選択した後に、「EC2 ダッシュボード」内の「リソース」の「インスタンス（実行中）」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801.png"><img decoding="async" class="alignnone size-medium wp-image-12213" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-300x113.png" alt="" width="300" height="113" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-300x113.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-1024x386.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-768x289.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801.png 1320w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると、現在実行中のインスタンスが表示され、前回Terraform等を用いて構築したEC2インスタンスが表示されていることが確認できました。</p>
<h2><span id="toc2">■インフラストラクチャを破壊・削除する</span></h2>
<p>確認後、破壊・削除のために、Windows10のコマンドプロンプトを起動します。起動後、前回、新しい構成を作成するために、「terraform-aws-instance」ディレクトリを初期化しました。</p>
<pre>&gt; cd terraform-aws-instance</pre>
<p>このディレクトリに移動するために、上記のコマンドを入力し、Enterキーを押し、ディレクトリに移動します。</p>
<pre>&gt; terraform destroy</pre>
<p>移動後、上記のコマンドを入力し、Enterキーを押します。これでEC2インスタンスの破壊・削除が行えます。</p>
<pre>aws_instance.app_server: Refreshing state... [id=i-*****]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  - destroy

Terraform will perform the following actions:

  # aws_instance.app_server will be destroyed
  - resource "aws_instance" "app_server" {
      - ami                                  = "ami-*****" -&gt; null
      - arn                                  = "arn:aws:ec2:us-west-2:*****7:instance/i-*****" -&gt; null
      - associate_public_ip_address          = true -&gt; null
      - availability_zone                    = "us-west-2c" -&gt; null
      - cpu_core_count                       = 1 -&gt; null
      - cpu_threads_per_core                 = 1 -&gt; null
      - disable_api_termination              = false -&gt; null
      - ebs_optimized                        = false -&gt; null
      - get_password_data                    = false -&gt; null
      - hibernation                          = false -&gt; null
      - id                                   = "i-*****" -&gt; null
      - instance_initiated_shutdown_behavior = "stop" -&gt; null
      - instance_state                       = "running" -&gt; null
      - instance_type                        = "t2.micro" -&gt; null
      - ipv6_address_count                   = 0 -&gt; null
      - ipv6_addresses                       = [] -&gt; null
      - monitoring                           = false -&gt; null
      - primary_network_interface_id         = "eni-*****" -&gt; null
      - private_dns                          = "ip-*****.us-west-2.compute.internal" -&gt; null
      - private_ip                           = "*****" -&gt; null
      - public_dns                           = "ec2-*****.us-west-2.compute.amazonaws.com" -&gt; null
      - public_ip                            = "*****" -&gt; null
      - secondary_private_ips                = [] -&gt; null
      - security_groups                      = [
          - "default",
        ] -&gt; null
      - source_dest_check                    = true -&gt; null
      - subnet_id                            = "subnet-09317e74ec8255608" -&gt; null
      - tags                                 = {
          - "Name" = "ExampleAppServerInstance"
        } -&gt; null
      - tags_all                             = {
          - "Name" = "ExampleAppServerInstance"
        } -&gt; null
      - tenancy                              = "default" -&gt; null
      - vpc_security_group_ids               = [
          - "sg-0e54552461f60cc59",
        ] -&gt; null

      - capacity_reservation_specification {
          - capacity_reservation_preference = "open" -&gt; null
        }

      - credit_specification {
          - cpu_credits = "standard" -&gt; null
        }

      - enclave_options {
          - enabled = false -&gt; null
        }

      - metadata_options {
          - http_endpoint               = "enabled" -&gt; null
          - http_put_response_hop_limit = 1 -&gt; null
          - http_tokens                 = "optional" -&gt; null
          - instance_metadata_tags      = "disabled" -&gt; null
        }

      - root_block_device {
          - delete_on_termination = true -&gt; null
          - device_name           = "/dev/sda1" -&gt; null
          - encrypted             = false -&gt; null
          - iops                  = 0 -&gt; null
          - tags                  = {} -&gt; null
          - throughput            = 0 -&gt; null
          - volume_id             = "vol-08d25f0e2140c5179" -&gt; null
          - volume_size           = 8 -&gt; null
          - volume_type           = "standard" -&gt; null
        }
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value:</pre>
<p>Enterキーを押すと、上記のようなメッセージが表示され、「Enter a value:」と出力されます。リソースを破壊・削除することを受け入れるために、「yes」と入力し、Enterキーを押します。</p>
<pre>aws_instance.app_server: Destroying... [id=i-********]
aws_instance.app_server: Still destroying... [id=i-********, 10s elapsed]
aws_instance.app_server: Still destroying... [id=i-********, 30s elapsed]
aws_instance.app_server: Destruction complete after 35s

Destroy complete! Resources: 1 destroyed.</pre>
<p>Enterキーを押すと、破壊・削除が開始され、「Destroy complete!」と出力されます。これが出力されれば、破壊・削除が完了となります。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133244.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12223" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133244-300x110.png" alt="" width="300" height="110" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133244-300x110.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133244-1024x375.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133244-768x281.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133244.png 1311w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>完了後、EC2インスタンスが破壊・削除されているか確認してみます。「EC2 ダッシュボード」内の「リソース」の「インスタンス（実行中）」をクリックすると、「一致するインスタンスが見つかりません」と表示され、インスタンスが破壊・削除されていることが確認できました。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133336.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12224" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133336-300x101.png" alt="" width="300" height="101" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133336-300x101.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133336-1024x344.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133336-768x258.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-20-133336.png 1324w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>なお、「EC2 ダッシュボード」内の「リソース」の「インスタンス」をクリックすると、今回破壊・削除したインスタンスが表示され「インスタンスの状態」が「終了済み」となっていました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/destroy-or-remove-infrastructure-using-terraform-or-other-tools/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Terraform等を用いてインフラストラクチャを構築する（Windows10）</title>
		<link>https://laboratory.kazuuu.net/build-infrastructure-using-terraform-and-other-tools-windows-10/</link>
					<comments>https://laboratory.kazuuu.net/build-infrastructure-using-terraform-and-other-tools-windows-10/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Tue, 19 Apr 2022 04:30:25 +0000</pubDate>
				<category><![CDATA[Amazon/AWS]]></category>
		<category><![CDATA[Terraform]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=12206</guid>

					<description><![CDATA[Terraform等を用いてインフラストラクチャを構築してみます。今回は、Amazon Web Services（AWS）でEC2インスタンスをプロビジョニング（利用可能な状態に準備）します。 なお、インフラストラクチャ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Terraform等を用いてインフラストラクチャを構築してみます。今回は、Amazon Web Services（AWS）でEC2インスタンスをプロビジョニング（利用可能な状態に準備）します。</p>
<p>なお、インフラストラクチャを構築するために、Terraform CLI、AWSCLI、AWSアカウントの取得と、AWSアカウントに関連したクレデンシャル（資格・認証情報）が必要になりますので、事前に取得などを行っておく必要があります。</p>
<p>まずは、Windows10のコマンドプロンプトを起動します。</p>
<pre>&gt; aws configure</pre>
<p>起動後、コマンドを入力し、Enterキーを押します。Enterキーを押すと、4つ（AWS Access Key ID,AWS Secret Access Key,region（リージョン・地域） name,出力形式）の情報の入力が求められますので、取得したクレデンシャル（資格・認証情報）等を入力していきます。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-124329-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12207" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-124329-1-300x69.png" alt="" width="300" height="69" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-124329-1-300x69.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-124329-1-1024x236.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-124329-1-768x177.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-124329-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>今回は上記のような形でセットアップします。</p>
<pre>&gt; mkdir terraform-aws-instance</pre>
<p>セットアップ後、上記のコマンドを入力し、「terraform-aws-instance」ディレクトリを作成します。</p>
<pre>&gt; cd terraform-aws-instance</pre>
<p>作成後、上記のコマンドを入力し、Enterキーを押します。これで作成したディレクトリに移動します。移動後、「terraform-aws-instance」内に「main.tf」というファイルを作成するのですが、コマンドプロンプト上だと「touch」コマンドが使えない場合があるので、今回はコマンドを使わずに「エクスプローラー」で「terraform-aws-instance」内に移動し、ファイルを作成します。</p>
<p>作成後、このファイルをコード・エディタで開きます。開いた後に、Terraformで展開するための構成を記述します。<a href="https://learn.hashicorp.com/tutorials/terraform/aws-build?in=terraform/aws-get-started">コードはこちらの情報を今回はコピーして貼り付けます。</a></p>
<p>貼り付けた後、コードをファイルに保存します。保存後、コマンドプロンプト上に戻ります。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-131610-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12208" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-131610-1-300x166.png" alt="" width="300" height="166" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-131610-1-300x166.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-131610-1-1024x566.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-131610-1-768x425.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-131610-1-160x90.png 160w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-131610-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<pre>Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/aws versions matching "~&gt; 3.27"...
- Installing hashicorp/aws v3.75.1...
- Installed hashicorp/aws v3.75.1 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.</pre>
<p>戻った後に新しい構成を作成するために、ディレクトリを初期化する必要があるので、上記のコマンドを入力し、Enterキーを押します。Enterキーを押すと、初期化が開始され上記のように出力されます。「Terraform has been successfully initialized!（Terraformは正常に初期化されました！）」と出力されているので、これで初期化は完了となります。</p>
<h2>■インフラストラクチャを作成する</h2>
<pre>&gt; terraform apply</pre>
<p>完了後、インフラストラクチャを作成しますので、上記のコマンドを入力し、Enterキーを押します。押すと、自動でEC2インスタンスの構築を行います。</p>
<p>構築が開始され、途中で「Enter a value:」と出力されますのでアクションを実行するために「yes」と入力し、Enterキーを押します。</p>
<p>Enterキーを押してしばらくすると「Apply complete!」と出力されます。これが表示されれば、構築は完了となります。</p>
<p>完了後、構築されているのか確認するために、AWSにログインし、「EC2」にアクセスします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12209" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-300x128.png" alt="" width="300" height="128" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-300x128.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-1024x436.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345-768x327.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132345.png 1264w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>アクセス後、「EC2 ダッシュボード」をクリックし、ダッシュボードの右上にある地域・リージョンが表示されている箇所をクリックします。今回は、「米国西部（オレゴン）us-west-2」でEC2インスタンスを作成しているので、「us-west-2」を選択します。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12210" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-300x161.png" alt="" width="300" height="161" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-300x161.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-1024x549.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1-768x412.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132634-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>選択した後に、「EC2 ダッシュボード」内の「リソース」の「インスタンス（実行中）」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12213" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-300x113.png" alt="" width="300" height="113" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-300x113.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-1024x386.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801-768x289.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-132801.png 1320w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると、現在実行中のインスタンスが表示され、今回Terraform等を用いて構築したEC2インスタンスが表示されていることが確認できました。</p>
<p>最後に構築が完了した後でAWSに登録しているメールアドレスに「Your Request For Accessing AWS Resources Has Been Validated（AWSリソースへのアクセスに関するお客様のリクエストは認証されました。）」というメールが通知されます。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/build-infrastructure-using-terraform-and-other-tools-windows-10/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Terraformのダウンロード・インストール（Windows10）</title>
		<link>https://laboratory.kazuuu.net/download-and-install-terraform-windows10/</link>
					<comments>https://laboratory.kazuuu.net/download-and-install-terraform-windows10/#respond</comments>
		
		<dc:creator><![CDATA[小林]]></dc:creator>
		<pubDate>Tue, 19 Apr 2022 03:35:53 +0000</pubDate>
				<category><![CDATA[Terraform]]></category>
		<guid isPermaLink="false">https://laboratory.kazuuu.net/?p=12195</guid>

					<description><![CDATA[Terraformのダウンロード・インストール（Windows10）について解説します。 目次 ■PC環境■ダウンロード■インストール■terraform.exeの環境変数パスを設定する■terraformコマンドを実行 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Terraformのダウンロード・インストール（Windows10）について解説します。</p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-6" checked><label class="toc-title" for="toc-checkbox-6">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">■PC環境</a></li><li><a href="#toc2" tabindex="0">■ダウンロード</a></li><li><a href="#toc3" tabindex="0">■インストール</a></li><li><a href="#toc4" tabindex="0">■terraform.exeの環境変数パスを設定する</a></li><li><a href="#toc5" tabindex="0">■terraformコマンドを実行する</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">■PC環境</span></h2>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123436-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12204" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123436-1-300x289.png" alt="" width="300" height="289" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123436-1-300x289.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123436-1-1024x987.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123436-1-768x740.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123436-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<h2><span id="toc2">■ダウンロード</span></h2>
<p>Terraformのダウンロードのために、「Downloads | Terraform by HashiCorp（<a href="https://www.terraform.io/downloads">https://www.terraform.io/downloads</a>）」にアクセスします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120202-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12196" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120202-1-300x234.png" alt="" width="300" height="234" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120202-1-300x234.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120202-1-1024x800.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120202-1-768x600.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120202-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>アクセスすると、「Windows」の項目に「WINDOWS BINARY DOWNLOAD」とありますので、今回はTerraformの「Amd64」をクリックします。なお、バージョンは1.1.8となります。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12197" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1-300x168.png" alt="" width="300" height="168" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1-300x168.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1-1024x573.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1-768x430.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1-120x68.png 120w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1-160x90.png 160w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1-320x180.png 320w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120505-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると、ダウンロードが開始され、しばらくすると、Webブラウザで指定されているファイルの保存場所に「terraform_1.1.8_windows_amd64.zip」というファイルがダウンロードされます。</p>
<h2><span id="toc3">■インストール</span></h2>
<p>ダウンロード後、「terraform_1.1.8_windows_amd64.zip」というファイルを展開、解凍します。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120851-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12198" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120851-1-300x161.png" alt="" width="300" height="161" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120851-1-300x161.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120851-1-1024x548.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120851-1-768x411.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-120851-1.png 1249w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>展開、解凍すると「terraform_1.1.8_windows_amd64」内に「terraform.exe」というexeファイルがあります。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121232-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12199" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121232-1-300x146.png" alt="" width="300" height="146" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121232-1-300x146.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121232-1-1024x497.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121232-1-768x373.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121232-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>このexeファイルを、今回は「C:\」内に「terraform」というフォルダを作成し、その中に移動します。</p>
<h2><span id="toc4">■terraform.exeの環境変数パスを設定する</span></h2>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121733-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12200" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121733-1-300x200.png" alt="" width="300" height="200" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121733-1-300x200.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121733-1-1024x682.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121733-1-768x511.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121733-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>移動後、Windows10タスクバーの「ここに入力して検索」で「システムの詳細設定」と入力すると、「システムの詳細設定の表示 &#8211; コントロールパネル」が検索結果に表示されるので、こちらをクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121935-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12201" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121935-1-272x300.png" alt="" width="272" height="300" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121935-1-272x300.png 272w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121935-1-928x1024.png 928w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121935-1-768x848.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-121935-1.png 1250w" sizes="(max-width: 272px) 100vw, 272px" /></a></p>
<p>クリックすると、「システムのプロパティ」の「詳細設定」ウインドウが表示されます。ウインドウ内の「環境変数」をクリックします。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-122304-1.png"><img loading="lazy" decoding="async" class="alignnone wp-image-12202 size-medium" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-122304-1-300x205.png" alt="" width="300" height="205" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-122304-1-300x205.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-122304-1-1024x699.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-122304-1-768x524.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-122304-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>クリックすると、「環境変数」ウインドウが表示され、「Path」をダブルクリックします。ダブルクリックすると、「環境変数名の編集」ウインドウが表示されます。ウインドウ内にterraform.exeが置かれている「C:\terraform」を追加します。追加後、「OK」ボタンをクリックします。</p>
<p>クリックすると、「環境変数名の編集」ウインドウが閉じ、「環境変数」ウインドウ内の「OK」ボタンをさらにクリックします。クリックすると、「環境変数」ウインドウも閉じ、「システムのプロパティ」内の「OK」ボタンもクリックして閉じます。これで環境変数の設定は完了です。</p>
<h2><span id="toc5">■terraformコマンドを実行する</span></h2>
<p>完了後、検証としてterraformコマンドを実行してみますので、コマンドプロンプトを起動します。</p>
<pre>&gt; terraform -version</pre>
<p>起動後、上記のコマンドを入力し、Enterキーを押します。</p>
<p><a href="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123211-1.png"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-12203" src="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123211-1-300x180.png" alt="" width="300" height="180" srcset="https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123211-1-300x180.png 300w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123211-1-1024x616.png 1024w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123211-1-768x462.png 768w, https://laboratory.kazuuu.net/wp-content/uploads/2022/04/スクリーンショット-2022-04-19-123211-1.png 1250w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>実行すると「Terraform v1.1.8 on windows_amd64」と出力されました。これでTerraformのダウンロードからのインストール、そして実行することの検証は完了となります。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://laboratory.kazuuu.net/download-and-install-terraform-windows10/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
