{"id":3195,"date":"2022-10-31T15:50:01","date_gmt":"2022-10-31T06:50:01","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/?p=3195"},"modified":"2022-10-31T15:51:49","modified_gmt":"2022-10-31T06:51:49","slug":"terraform-apply-safely","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2022\/10\/31\/terraform-apply-safely\/","title":{"rendered":"terraform apply\u3092\u3088\u308a\u5b89\u5168\u306b\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u3067\u304d\u308b\u3053\u3068"},"content":{"rendered":"\n
\u897f\u85e4\u3067\u3059\u3002
\u5f53\u793e\u3067\u306fTerraform\u3092\u6d3b\u7528\u3057\u3066AWS\u30af\u30e9\u30a6\u30c9\u4e0a\u3067\u306e\u30a4\u30f3\u30d5\u30e9\u69cb\u7bc9\u3092\u6570\u591a\u304f\u884c\u3063\u3066\u304a\u308a\u307e\u3059\u3002
IaC\uff08Infrastructure as Code\uff09\u5316\u304c\u9032\u3080\u3053\u3068\u306b\u3088\u308a\u30a4\u30f3\u30d5\u30e9\u69cb\u6210\u306e\u518d\u6d3b\u7528\u304c\u9032\u307f\u3001\u307e\u305f\u8fc5\u901f\u306a\u30d4\u30a2\u30ec\u30d3\u30e5\u30fc\u3082\u3084\u308a\u3084\u3059\u304f\u306a\u308a\u3001\u5b9f\u88c5\u30b9\u30d4\u30fc\u30c9\u304c\u4e0a\u304c\u308b\u3053\u3068\u3092\u65e5\u3005\u5b9f\u611f\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n
\u305f\u3060\u3057\u3001IaC\u306f\u305d\u306e\u4e07\u80fd\u3055\u3086\u3048\u306b\u3001\u4e88\u671f\u305b\u306c\u5f62\u3067\u306e\u4e8b\u6545\u306b\u3064\u306a\u304c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u300cterraform plan\u3067\u306f\u554f\u984c\u306a\u304b\u3063\u305f\u306e\u306bterraform apply\u3092\u3057\u305f\u3089\u5931\u6557\u3057\u3066\u614c\u3066\u305f\u300d\u3068\u3044\u3046\u7d4c\u9a13\u3092\u304a\u6301\u3061\u306e\u65b9\u3082\u3044\u3089\u3063\u3057\u3083\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n\n\n\n
\u4eca\u56de\u306f\u3001\u305d\u3046\u3044\u3063\u305fterraform apply\u3092\u5b9f\u884c\u3059\u308b\u969b\u306e\u4e0d\u5b89\u3092\u6e1b\u3089\u3057\u3001\u3088\u308a\u5b89\u5168\u306b\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3092\u8003\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n
\u307e\u305a\u306f\u3001Terraform\u3092\u4f7f\u3063\u305f\u69cb\u7bc9\u306e\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9\u306a\u6d41\u308c\u3060\u3068\u601d\u3044\u307e\u3059\u304c\u3001Terraform\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u305f\u3089\u3001\u6a19\u6e96\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u8a18\u8ff0\u3057\u305f\u5185\u5bb9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n\n\n\n
\u3068\u3044\u3046\u306e\u304c\u57fa\u672c\u7684\u306a\u6d41\u308c\u3067\u3001\u591a\u304f\u306eTerraform\u5229\u7528\u8005\u304c\u5b9f\u8df5\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3068\u601d\u3044\u307e\u3059\u3002
\u305d\u308c\u3089\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6398\u308a\u4e0b\u3052\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n
https:\/\/www.terraform.io\/cli\/commands\/fmt<\/a><\/p>\n\n\n\n \u305f\u3068\u3048\u3070\u3001<\/p>\n\n\n\n \u3068\u3044\u3063\u305f\u30a4\u30f3\u30c7\u30f3\u30c8\u304c\u63c3\u3063\u3066\u3044\u306a\u3044\u30b3\u30fc\u30c9\u304c\u3042\u308c\u3070<\/p>\n\n\n\n \u3068\u3044\u3046\u5177\u5408\u306b \u306e\u3088\u3046\u306b\u30a4\u30f3\u30c7\u30f3\u30c8\u304c\u6574\u7406\u3055\u308c\u305f\u30b3\u30fc\u30c9\u306b\u66f8\u304d\u63db\u3048\u3066\u304f\u308c\u307e\u3059\u3002 \u6b21\u306b\u3001 https:\/\/www.terraform.io\/cli\/commands\/validate<\/a><\/p>\n\n\n\n \u305f\u3068\u3048\u3070<\/p>\n\n\n\n \u3068\u8a00\u3046\u3088\u3046\u306a\u69cb\u6210\u3092\u3057\u3066\u3044\u3066\u3001 \u306e\u3088\u3046\u306b\u66f8\u304d\u3001 \u306e\u3088\u3046\u306bAMI\u3084\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u306b\u6307\u5b9a\u3055\u308c\u308b\u6587\u5b57\u5217\u306b\u5bfe\u3057\u3066\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u3066\u6761\u4ef6\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n \u305d\u3057\u3066\u3001 \u3068\u3057\u305f\u3068\u3057\u307e\u3059\u3002<\/p>\n\n\n\n \u3053\u306e\u969b\u306b \u306e\u3088\u3046\u306b\u30a8\u30e9\u30fc\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 \u3061\u306a\u307f\u306b\u3001\u5404\u5024\u3092\u4fee\u6b63\u3057\u305f\u4e0a\u3067\u518d\u5b9f\u884c\u3059\u308b\u3068<\/p>\n\n\n\n \u3068\u306a\u308a\u3001\u554f\u984c\u306a\u304f\u306a\u3063\u305f\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n \u6700\u5f8c\u306b \u3068\u3044\u3046\u5177\u5408\u306bEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u4f5c\u6210\u3055\u308c\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n terraform plan\u304c\u5931\u6557\u3059\u308b\u72b6\u6cc1\u3067\u3042\u308c\u3070\u3001\u3082\u3061\u308d\u3093apply\u6642\u306b\u3082\u5931\u6557\u3057\u307e\u3059\u306e\u3067\u3001apply\u524d\u306e\u78ba\u8a8d\u306b\u6709\u52b9\u3067\u3059\u3002<\/p>\n\n\n\n \u305f\u3060\u3057\u3001terraform plan\u306f\u3042\u304f\u307e\u3067\u8a18\u8ff0\u3057\u305f\u30b3\u30fc\u30c9\u3092\u3082\u3068\u306b\u3069\u306e\u3088\u3046\u306a\u5909\u66f4\u304c\u52a0\u3048\u3089\u308c\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u304b\u306e\u4e88\u6e2c\u3092\u8868\u793a\u3059\u308b\u3082\u306e\u3067\u3042\u308a\u3001\u6700\u7d42\u7684\u306b\u305d\u306e\u5909\u66f4\u304c\u6b63\u5e38\u306b\u884c\u308f\u308c\u308b\u304b\u3092\u78ba\u7d04\u3057\u307e\u305b\u3093\u3002<\/p>\n\n\n\n The plan command alone does not actually carry out the proposed changes.<\/p>https:\/\/www.terraform.io\/cli\/commands\/plan<\/a><\/cite><\/blockquote>\n\n\n\n Terraform\u306e\u6587\u6cd5\u7684\u306b\u306f\u6b63\u3057\u3044\u304c\u3001AWS\u306e\u30ea\u30bd\u30fc\u30b9\u306e\u4ed5\u69d8\u3068\u3057\u3066\u306f\u5c5e\u6027\u306e\u5024\u306e\u6307\u5b9a\u304c\u9593\u9055\u3063\u3066\u3044\u308b\u969b\u306b\u306f<\/p>\n\n\n\n \u3068\u3044\u3046\u3053\u3068\u304c\u8d77\u3053\u308a\u3001\u3053\u308c\u306b\u82e6\u52b4\u3059\u308b\u3053\u3068\u3082\u591a\u3044\u3067\u3059\u3002<\/p>\n\n\n\n \u305d\u306e\u305f\u3081\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u8ffd\u52a0\u306e\u5bfe\u7b56\u3092\u5165\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n validate, plan\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3042\u3089\u304b\u3058\u3081validation\u306econdition\u3067\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3082\u306e\u3060\u3063\u305f\u308a\u3001Terraform\u3067\u306e\u6587\u6cd5\u7684\u306a\u6b63\u3057\u3055\u3067\u3057\u304b\u691c\u8a3c\u3092\u3057\u3066\u304f\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n \u305f\u3068\u3048\u3070\u3001test.tf\u306b\u3066<\/p>\n\n\n\n \u3068\u8a00\u3046\u5f62\u3067\u3001\u5b58\u5728\u3057\u306a\u3044EC2\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u3092\u6307\u5b9a\u3057\u3066\u3082\u3001\u691c\u51fa\u3057\u3066\u304f\u308c\u305a\u3001\u305d\u306e\u307e\u307eterraform apply\u307e\u3067\u5b9f\u884c\u3057\u3066\u3057\u307e\u3046\u3068<\/p>\n\n\n\n \u3068\u8a00\u3046\u5177\u5408\u3067\u3001\u30ea\u30bd\u30fc\u30b9\u306e\u4f5c\u6210\u3092\u3057\u3088\u3046\u3068\u3059\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u306b\u306a\u3063\u3066\u3001\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n\n\n\n \u4eee\u306b\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u30d6\u30e9\u30f3\u30c1\u306bcommit push\u3055\u308c\u305f\u3089apply\u3092\u3059\u308b\u3068\u8a00\u3046\u3088\u3046\u306a\u81ea\u52d5\u5316\u3092\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u6b63\u3057\u304fapply\u3067\u304d\u306a\u3044\u30b3\u30fc\u30c9\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u30d6\u30e9\u30f3\u30c1\u306b\u8f09\u3063\u3066\u3057\u307e\u3044\u3001IaC\u3067\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u5185\u5bb9\u3068\u5b9f\u614b\u304c\u4e56\u96e2\u3057\u3066\u3044\u308b\u72b6\u6cc1\u3092\u62db\u3044\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n\n\n\n \u3053\u308c\u3092\u9632\u3054\u3046\u3068\u3057\u3066\u3001\u305f\u3068\u3048\u3070AWS\u3067\u5229\u7528\u53ef\u80fd\u306aEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u306e\u4e00\u89a7\u3092validation\u306econdition\u306e\u4e2d\u306b\u4e8b\u7d30\u304b\u304f\u5217\u6319\u3057\u3066\u30ab\u30d0\u30fc\u3057\u3088\u3046\u3068\u3059\u308b\u306e\u3082\u52b4\u529b\u304c\u304b\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\nterraform fmt<\/code>\u30b3\u30de\u30f3\u30c9\u306f\u8a18\u8ff0\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u6b63\u898f\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u30b9\u30bf\u30a4\u30eb\u306b\u5408\u308f\u305b\u3066\u6574\u5f62\u3092\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n
resource "aws_instance" "web" {\nami = "ami-078296f82eb463377"\ninstance_type = "t3.micro"\n}<\/code><\/pre><\/div>\n\n\n\n
$ terraform fmt\ntest.tf<\/code><\/pre><\/div>\n\n\n\n
terraform fmt<\/code>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001<\/p>\n\n\n\n
resource "aws_instance" "web" {\n ami = "ami-078296f82eb463377"\n instance_type = "t3.micro"\n}<\/code><\/pre><\/div>\n\n\n\n
\u3053\u308c\u306b\u3088\u308a\u3001\u30b3\u30fc\u30c9\u306e\u898b\u3048\u65b9\u304c\u4e00\u5b9a\u3057\u305f\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u81ea\u8eab\u3067\u306e\u30b3\u30fc\u30c9\u306e\u78ba\u8a8d\u3084\u30d4\u30a2\u30ec\u30d3\u30e5\u30fc\u3092\u884c\u3046\u969b\u306b\u6307\u6458\u3059\u3079\u304d\u4e8b\u9805\u306e\u898b\u9003\u3057\u9632\u6b62\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\nterraform validate<\/h4>\n\n\n\n
terraform validate<\/code>\u30b3\u30de\u30f3\u30c9\u3067\u8a18\u8ff0\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u69cb\u6587\u7684\u306b\u6b63\u3057\u3044\u304b\u306a\u3069\u306e\u691c\u67fb\u3092\u884c\u3044\u307e\u3059\u3002
\u3068\u304f\u306bmodule\u3092\u4f7f\u3063\u3066\u5024\u306e\u5f15\u304d\u6e21\u3057\u3092\u3059\u308b\u969b\u306e\u30c1\u30a7\u30c3\u30af\u306b\u52b9\u679c\u7684\u3068\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n.\n\u251c\u2500\u2500 modules\n\u2502 \u2514\u2500\u2500 web\n\u2502 \u251c\u2500\u2500 inputs.tf\n\u2502 \u251c\u2500\u2500 main.tf\n\u2502 \u2514\u2500\u2500 outputs.tf\n\u2514\u2500\u2500 test.tf<\/code><\/pre><\/div>\n\n\n\n
\u547c\u3073\u51fa\u3057\u5143\u306e\u3001test.tf\u3067\u306f<\/p>\n\n\n\nmodule "web" {\n source = ".\/modules\/web"\n ami = "aami-078296f82eb463377" #\u308f\u3056\u3068\u8aa4\u3063\u305f\u8a18\u8f09\u3092\u5165\u308c\u3066\u3044\u308b\n instance_type = "t2.micro" #\u308f\u3056\u3068\u8aa4\u3063\u305f\u8a18\u8f09\u3092\u5165\u308c\u3066\u3044\u308b\n}<\/code><\/pre><\/div>\n\n\n\n
modules\/web\/inputs.tf<\/code>\u3067\u306f<\/p>\n\n\n\n
# ami for web server\nvariable "ami" {\n description = "AMI for web server"\n type = string\n\n validation {\n condition = can(regex("^ami-", var.ami))\n error_message = "AMI \u306f 'ami-' \u304b\u3089\u306f\u3058\u307e\u308b\u6587\u5b57\u5217\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002"\n }\n}\n\n# instance type for web server\nvariable "instance_type" {\n description = "Instance type for web server"\n type = string\n\n validation {\n condition = can(regex("^t3", var.instance_type))\n error_message = "Instance type \u306f 't3' \u304b\u3089\u306f\u3058\u307e\u308b\u30bf\u30a4\u30d7\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002"\n }\n}<\/code><\/pre><\/div>\n\n\n\n
modules\/web\/main.tf<\/code>\u3067\u306f<\/p>\n\n\n\n
resource "aws_instance" "web" {\n ami = var.ami\n instance_type = var.instance_type\n}<\/code><\/pre><\/div>\n\n\n\n
terraform validate<\/code>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068<\/p>\n\n\n\n
$ terraform validate\n\u2577\n\u2502 Error: Invalid value for variable\n\u2502 \n\u2502 on test.tf line 3, in module "web":\n\u2502 3: ami = "aami-078296f82eb463377" #\u308f\u3056\u3068\u8aa4\u3063\u305f\u8a18\u8f09\u3092\u5165\u308c\u3066\u3044\u308b\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\u2502 \u2502 var.ami is "aami-078296f82eb463377"\n\u2502 \n\u2502 AMI \u306f 'ami-' \u304b\u3089\u306f\u3058\u307e\u308b\u6587\u5b57\u5217\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n\u2502 \n\u2502 This was checked by the validation rule at modules\/web\/inputs.tf:6,3-13.\n\u2575\n\u2577\n\u2502 Error: Invalid value for variable\n\u2502 \n\u2502 on test.tf line 4, in module "web":\n\u2502 4: instance_type = "t2.micro" #\u308f\u3056\u3068\u8aa4\u3063\u305f\u8a18\u8f09\u3092\u5165\u308c\u3066\u3044\u308b\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\u2502 \u2502 var.instance_type is "t2.micro"\n\u2502 \n\u2502 Instance type \u306f 't3' \u304b\u3089\u306f\u3058\u307e\u308b\u30bf\u30a4\u30d7\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\n\u2502 \n\u2502 This was checked by the validation rule at modules\/web\/inputs.tf:17,3-13.<\/code><\/pre><\/div>\n\n\n\n
\u3053\u308c\u306f\u3001modules\/web\/inputs.tf<\/code>\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u305f\u5404variable\u3054\u3068\u306evalidation\u6761\u4ef6\u3068module\u306b\u5f15\u304d\u6e21\u3055\u308c\u305f\u5024\u3092\u7a81\u304d\u5408\u308f\u305b\u3066\u691c\u67fb\u3057\u305f\u7d50\u679c\u3001\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u305f\u3081\u3001 \u30e1\u30c3\u30bb\u30fc\u30b8\u3068\u5171\u306b\u6307\u6458\u3092\u3057\u3066\u304f\u308c\u3066\u3044\u307e\u3059\u3002
\u3053\u308c\u306b\u3088\u308a\u30a4\u30f3\u30d5\u30e9\u69cb\u7bc9\u306b\u969b\u3057\u3066\u3001\u81ea\u5206\u9054\u3067\u5b9a\u7fa9\u3057\u305f\u30dd\u30ea\u30b7\u30fc\u306b\u6cbf\u308f\u306a\u3044\u30ea\u30bd\u30fc\u30b9\u304c\u4f5c\u3089\u308c\u3066\u3057\u307e\u3046\u3053\u3068\u3092\u9632\u6b62\u3057\u305f\u308a\u3001\u60f3\u5b9a\u5916\u306e\u5024\u304c\u6307\u5b9a\u3055\u308c\u308b\u3053\u3068\u3092\u9632\u6b62\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n$ terraform validate\nSuccess! The configuration is valid.<\/code><\/pre><\/div>\n\n\n\n
terraform plan<\/h4>\n\n\n\n
terraform plan<\/code>\u306b\u3088\u3063\u3066\u300c\u3053\u306e\u30b3\u30fc\u30c9\u3067\u4f55\u304c\u4f5c\u6210\u3055\u308c\u3001\u524a\u9664\u3055\u308c\u3001\u66f4\u65b0\u3055\u308c\u305d\u3046\u304b\u300d\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002
\u4e0a\u8a18\u306evalidate\u306e\u691c\u67fb\u3092\u901a\u904e\u3057\u305f\u30b3\u30fc\u30c9\u3092\u4f7f\u3046\u3068<\/p>\n\n\n\n$ terraform plan\n\nTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:\n + create\n\nTerraform will perform the following actions:\n\n # module.web.aws_instance.web will be created\n + resource "aws_instance" "web" {\n + ami = "ami-078296f82eb463377"\n + arn = (known after apply)\n + associate_public_ip_address = (known after apply)\n + availability_zone = (known after apply)\n + cpu_core_count = (known after apply)\n + cpu_threads_per_core = (known after apply)\n + disable_api_stop = (known after apply)\n + disable_api_termination = (known after apply)\n + ebs_optimized = (known after apply)\n + get_password_data = false\n + host_id = (known after apply)\n + host_resource_group_arn = (known after apply)\n + id = (known after apply)\n + instance_initiated_shutdown_behavior = (known after apply)\n + instance_state = (known after apply)\n + instance_type = "t3.micro"\n + ipv6_address_count = (known after apply)\n + ipv6_addresses = (known after apply)\n\n<\u7565>\n\n }\n\nPlan: 1 to add, 0 to change, 0 to destroy.<\/code><\/pre><\/div>\n\n\n\n
2. tflint\u3092\u4f7f\u3046<\/h3>\n\n\n\n
module "web" {\n source = ".\/modules\/web"\n ami = "ami-078296f82eb463377"\n instance_type = "t3.supermicro" #\u308f\u3056\u3068\u5b58\u5728\u3057\u306a\u3044\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u3092\u6307\u5b9a\n}<\/code><\/pre><\/div>\n\n\n\n
$ terraform apply\n\nTerraform used the selected providers to generate the following execution plan. Resource actions are\nindicated with the following symbols:\n + create\n\nTerraform will perform the following actions:\n\n # module.web.aws_instance.web will be created\n + resource "aws_instance" "web" {\n + ami = "ami-078296f82eb463377"\n + arn = (known after apply)\n + associate_public_ip_address = (known after apply)\n + availability_zone = (known after apply)\n + cpu_core_count = (known after apply)\n + cpu_threads_per_core = (known after apply)\n + disable_api_stop = (known after apply)\n + disable_api_termination = (known after apply)\n + ebs_optimized = (known after apply)\n + get_password_data = false\n + host_id = (known after apply)\n + host_resource_group_arn = (known after apply)\n + id = (known after apply)\n + instance_initiated_shutdown_behavior = (known after apply)\n + instance_state = (known after apply)\n + instance_type = "t3.supermicro"\n + ipv6_address_count = (known after apply)\n + ipv6_addresses = (known after apply)\n\n<\u7565> \n\n }\n\nPlan: 1 to add, 0 to change, 0 to destroy.\n\nDo you want to perform these actions in workspace "blog-sample"?\n Terraform will perform the actions described above.\n Only 'yes' will be accepted to approve.\n\n Enter a value: yes\n\nmodule.web.aws_instance.web: Creating...\n\u2577\n\u2502 Error: creating EC2 Instance: InvalidParameterValue: Invalid value 't3.supermicro' for InstanceType.\n\u2502 status code: 400, request id: 2e934398-2e8d-471a-824e-f46ee9083df0\n\u2502 \n\u2502 with module.web.aws_instance.web,\n\u2502 on modules\/web\/main.tf line 1, in resource "aws_instance" "web":\n\u2502 1: resource "aws_instance" "web" {\n\u2502 \n\u2575<\/code><\/pre><\/div>\n\n\n\n