æ¦è¦
Moduleã¯Terraformã®è¤æ°ã®ãªã½ã¼ã¹ãã¾ã¨ãã¦åå©ç¨å¯è½ãªåä½ã¨ãã¦æ±ããã¨ãã§ãã¾ããModuleã使ããã¨ã§è¤éãªãªã½ã¼ã¹æ§æãæ½è±¡åããã·ã¹ãã ã®æ§é ã®ææ¡ããªã½ã¼ã¹æ§æã®åå©ç¨ãå¯è½ã«ãªããèªã¿ããããå¯èªæ§ãåä¸ããä¿®æ£ç®æãåä¸ã«ãªããªã©ã®ã¡ãªãããããã¾ãã
ãã ããçè§£ã«ã¯åæã³ã¹ããå¿ è¦ã§ããModuleã®è¨è¨ã§ã¯ã1ã¤ã®æ©è½ãæã¤ããã«å°ããã·ã³ãã«ã«ä¿ã¤ãã¨ãéè¦ã§ããããé£ããå ´åã¯å¤§æµè¤éã¨è¨ãã¾ãã
ã¾ããå ¬å¼ã®Moduleãå©ç¨ãããã¨ã§ãèªèº«ã§å®ç¾©ãããã¥ã¡ã³ãã®æ´åãã¡ã³ããã³ã¹ã®æéãçãã¤ã¤ãããã¸ã§ã¯ããè¶ ãã¦å ±éèªèã¨ãã¦æ±ãããããModuleçè§£ã®ã³ã¹ããæ¸ãã¾ãã
ããããã©ã®ã¿ã¤ãã³ã°ã§Moduleã«çµã¿è¾¼ããã®æ£è§£ã¯ãåã ã®ããã¸ã§ã¯ãã®ç¹æ§ãéçºãã¼ã ã®ç¶æ³ã«ãã大ãã«å¤ããã§ãããã
çµ¶ãã試è¡é¯èª¤ãç¹°ãè¿ããªããåã ã®ããã¸ã§ã¯ããã¨ã«æé©ãªè§£ãè¦ã¤ãããã¨ãæ±ãããã¾ãããã®ããã°ã§ã¯ãããã®è©±ã®åã«Terraform Modulesã«ã¤ãã¦å©ç¨æ¹æ³ãã¾ã¨ãã¦ã¿ã¾ããã
- æ¦è¦
- Module ãå©ç¨ãã
- moduleã®ä½¿ãæ¹
- moduleã®å ¥å
- ãã¼ã«ã«ããã¾ãå©ç¨ãã
- moduleã®åºå
- module ã使ã£ãã¨ãã®å¤±æã«ã¤ãã¦
- æå¾ã«
- åè
Module ãå©ç¨ãã
ã·ã¹ãã ãæ§ç¯ããã«ããã£ã¦éçºãæ¤è¨¼ãæ¬çªç°å¢ãããããç¨æãããã¨ãå¤ãã§ãããTerraformãç°å¢ãã¨ï¼ä¾ï¼éçºç°å¢ãã¹ãã¼ã¸ã³ã°ç°å¢ãæ¬çªç°å¢ï¼ã«ã·ã³ãã«ãªWebãµã¼ãã¼ã®æ§æãä¾ã«ãã¦Moduleã使ããªãã¨ãã¨ä½¿ã£ãã¨ãã®æ§æãæ¯è¼ãã¦ã¿ã¾ãããã
Terraform Configuration |--- Development Environment | |--- VM Instances (Web servers) | |--- Firewall Rules (Allow HTTP/HTTPS traffic to the web servers) | |--- Load Balancer (Balance traffic among VM instances) | |--- Storage Bucket (Store static content) |--- Staging Environment | |--- VM Instances (Web servers) | |--- Firewall Rules (Allow HTTP/HTTPS traffic to the web servers) | |--- Load Balancer (Balance traffic among VM instances) | |--- Storage Bucket (Store static content) |--- Production Environment | |--- VM Instances (Web servers) | |--- Firewall Rules (Allow HTTP/HTTPS traffic to the web servers) | |--- Load Balancer (Balance traffic among VM instances) | |--- Storage Bucket (Store static content)
ãã®æ§æã§ã¯ã ç°å¢æ¯ã«VM Instances ãFirewall Rules ã Load Balancer ãStorage Bucket ãªã©ã®ãªã½ã¼ã¹ãå®ç¾©ããã¦ãã¦ç°å¢éã§ç°ãªããªã½ã¼ã¹è¨å®ãå©ç¨ãã¾ãã
䏿¹ãmoduleã使ç¨ããå ´åã®æ§æã¯ä»¥ä¸ã®ããã«ãªãã¾ãã
Terraform Configuration |--- modules | |--- user_service_cluster | |--- main.tf | | |--- VM Instances (Web servers) | | |--- Firewall Rules (Allow HTTP/HTTPS traffic to the web servers) | | |--- Load Balancer (Balance traffic among VM instances) | | |--- Storage Bucket (Store static content) | |--- variables.tf | |--- output.tf |--- Development Environment | |--- User-Service-Cluster Module (source: ../modules/user_service_cluster) |--- Staging Environment | |--- User-Service-Cluster Module (source: ../modules/user_service_cluster) |--- Production Environment | |--- User-Service-Cluster Module (source: ../modules/user_service_cluster)
ãã®æ§æã§ã¯ã user_service_cluster moduleã®main.tfãã¡ã¤ã«å
ã«VM Instances ãFirewall Rules ã Load Balancer ãStorage Bucket ãªã©ã®ãªã½ã¼ã¹ãå®ç¾©ããã¦ãã¾ããåç°å¢ã¯ãã®user_service_clustermoduleãåç
§ãã¦ãããç°å¢éã§å
±éã®ãªã½ã¼ã¹è¨å®ãåå©ç¨ãã¾ããããã«ãã£ã¦åå©ç¨æ§ãå¯èªæ§ãä¸ããç¶æç®¡çæ§ãé«ããäºãã§ããã¨æãã¾ãã
moduleã®ä½¿ãæ¹
Terraformã® moduleã¯ããªã½ã¼ã¹è¨å®ã®åå©ç¨å¯è½ãªé¨åã§ãã³ã¼ãã®æ½è±¡åã¨çµç¹åããµãã¼ããã¾ãã moduleã¯ä¸ã¤ä»¥ä¸ã®ãªã½ã¼ã¹ãå®ç¾©ããããããã¾ã¨ãã¦ç®¡çãããã¨ãã§ãã¾ãã
moduleã使ç¨ããããã«ã¯ã moduleãããã¯ãmain.tfï¼ã¾ãã¯ãã®ä»ã®.tfãã¡ã¤ã«ï¼ã«è¿½å ããããã§moduleã®ã½ã¼ã¹ã¨ä»»æã®å ¥å夿°ãæå®ãã¾ãã以ä¸ã«ãuser_service_cluster moduleã使ç¨ããããã®åºæ¬çãªmodule ãããã¯ã®ä¾ã示ãã¾ãã
module "user_service_cluster" { source = "../modules/user_service_cluster" instance_type = "n1-standard-1" instance_count = 3 firewall_rules = { allow_http = true allow_https = true } load_balancer_config = { protocol = "HTTP" port = 80 } bucket_name = "dev-bucket" }
source屿§ã«moduleã®ã½ã¼ã¹ã³ã¼ããåå¨ãããã¹ãæå®ãã¦ãã¾ããããã¦ãuser_service_cluster moduleãå®ç¾©ããåå
¥å夿°ãè¨å®ãã¦ãã¾ãã
moduleã¯ããã®ã½ã¼ã¹å
ã§variableãããã¯ã使ç¨ãã¦å
¥å夿°ãå®ç¾©ãã¾ãããããã®å
¥å夿°ã¯ãmoduleã®ä½¿ç¨è
ãå¤ãæä¾ãããã¨ã§moduleã®æ¯ãèããã«ã¹ã¿ãã¤ãºã§ãã¾ãã
ã¾ããmoduleã¯outputãããã¯ã使ç¨ãã¦åºåå¤ãå®ç¾©ãã¾ããåºåå¤ã¯ãmoduleã®å
é¨ãªã½ã¼ã¹ã®å±æ§ãmoduleã®å¤é¨ã«å
¬éããããã«ä½¿ç¨ããã¾ããããã«ãããä»ã®ãªã½ã¼ã¹ãmoduleãmoduleããçæããããªã½ã¼ã¹ãåç
§ãããã¨ãå¯è½ã«ãªãã¾ãã
moduleåã¯Terraformã®ã³ã¼ããã¼ã¹ãçµç¹åããåå©ç¨å¯è½ãªã³ã¼ãã使ããããã®éè¦ãªææ®µã§ããããã«ãããä¸è²«æ§ãä¿ãããã¡ã³ããã³ã¹ã容æã«ãªããã¨ã©ã¼ã®å¯è½æ§ã使¸ãã¾ãã
moduleã®å ¥å
Terraformã®moduleã¯åå©ç¨å¯è½ãªã³ã¼ããããã¯ã§ãå ¥å夿°ï¼input variablesï¼ã使ç¨ãã¦ã«ã¹ã¿ãã¤ãºã§ãã¾ãããããã®å ¥å夿°ã¯ãmoduleãããã¯ã§è¨å®ãã¾ãã
以ä¸ã«ãuser_service_cluster moduleã§ä½¿ç¨ããå
¥å夿°ã®ä¾ã示ãã¾ãã
ã¾ããmoduleèªä½ã®variables.tfãã¡ã¤ã«ã«ã¯ä»¥ä¸ã®ããã«å ¥å夿°ãå®ç¾©ãã¾ã
variable "instance_type" { description = "The type of instance to start" type = string default = "n1-standard-1" } variable "instance_count" { description = "Number of instances to create" type = number default = 1 } variable "firewall_rules" { description = "Firewall rules for instances" type = map(any) default = {} } variable "load_balancer_config" { description = "Configuration for load balancer" type = map(any) default = {} } variable "bucket_name" { description = "Name of the storage bucket" type = string default = "default-bucket" }
ããã¦ããã®module ãå¼ã³åºãéã«ãå ·ä½çãªå¤ãè¨å®ãã¾ãï¼
module "user_service_cluster" { source = "../modules/user_service_cluster" instance_type = "n1-standard-1" instance_count = 3 firewall_rules = { allow_http = true allow_https = true } load_balancer_config = { protocol = "HTTP" port = 80 } bucket_name = "dev-bucket" }
ä¸è¨ã®ä¾ã§ã¯ãuser_service_cluster moduleã¯sourceã§æå®ãããã½ã¼ã¹ãããã¼ããããinstance_typeãinstance_countãfirewall_rulesãload_balancer_configãbucket_nameã¨ããå
¥å夿°ãè¨å®ãã¦ãã¾ãã
module ã«å ¥å夿°ãæä¾ãããã¨ã§ãmodule ã®åä½ãã«ã¹ã¿ãã¤ãºããç°ãªãç°å¢ãæ¡ä»¶ã§åå©ç¨ãããã¨ãå¯è½ã«ãªãã¾ãã
ãã¼ã«ã«ããã¾ãå©ç¨ãã
Terraformã®localsãããã¯ã使ç¨ããã¨ãåå©ç¨å¯è½ãªå
é¨å¤æ°ãmoduleå
ã§å®ç¾©ãããã¨ãã§ãã¾ããlocalsã¯moduleå
ã§å
±æãããmoduleå¤ããã¯åç
§ã§ãã¾ããã
以ä¸ã«ãuser_service_cluster module ã®localsã®ä¾ã示ãã¾ãããã®ä¾ã§ã¯ãHTTPãã¼ããä»»æã®ãã¼ããä»»æã®ãããã³ã«ãTCPãããã³ã«ãããã¦å
¨ã¦ã®IPã¢ãã¬ã¹ããã¼ã«ã«å¤æ°ã¨ãã¦å®ç¾©ãã¦ãã¾ãã
locals { http_port = 80 any_port = 0 any_protocol = "-1" tcp_protocol = "tcp" all_ips = ["0.0.0.0/0"] }
ãã¼ã«ã«å¤æ°ã¯local.<NAME>ã®å½¢å¼ã§åç
§ãã¾ãã以ä¸ã®ãªã½ã¼ã¹å®ç¾©ã§ã¯ããã¼ããã©ã³ãµã¼ãªã¹ãã¼ã¨ã»ãã¥ãªãã£ã°ã«ã¼ãã®è¨å®ã«ãã¼ã«ã«å¤æ°ã使ç¨ãã¦ãã¾ãã
resource "google_compute_instance" "http" { name = "web-instance" machine_type = "n1-standard-1" network_interface { network = "default" access_config { // Assign an ephemeral IP to the instance } } // Other configuration... } resource "google_compute_firewall" "default" { name = "default-firewall" network = "default" allow { protocol = local.tcp_protocol ports = [local.http_port] } source_ranges = local.all_ips }
ä¸è¨ã®ä¾ã§ã¯ããã¼ããã©ã³ãµã¼ãªã¹ãã¼ã¨ã»ãã¥ãªãã£ã°ã«ã¼ãã§localsãããã¯ã«å®ç¾©ãããã¼ã«ã«å¤æ°ãåç
§ãã¦ãã¾ããlocal.http_portãlocal.tcp_protocolãlocal.all_ipsãåãªã½ã¼ã¹ãããã¯ã§åç
§ãããã¨ã§ãã³ã¼ããDRYã«ä¿ãããããèªã¿ããããã¡ã³ããã³ã¹ããããããªãã¾ãã
localsãããã¯ã使ç¨ãããã¨ã§ãã³ã¼ãã®åé·æ§ãæ¸ãããmoduleå
¨ä½ã®ä¸è²«æ§ãä¿ã¤ãã¨ãã§ãã¾ããã¾ãããã¼ã«ã«å¤æ°ã使ç¨ãããã¨ã§ãmoduleã®ä¸é¨ã§ä½¿ç¨ãã夿°ãmoduleå
¨ä½ã§å
±æãããã¨ãå¯è½ã«ãªãã¾ãã
moduleã®åºå
Terraformã®moduleã¯ãåºå夿°ï¼outputsï¼ãæä¾ã§ãã¾ããåºå夿°ã¯moduleã®å¤ãå¤é¨ã«å ¬éããããã®ææ®µã§ãmoduleã使ç¨ãã¦ããã³ã¼ãããã¢ã¯ã»ã¹ã§ãã¾ããã¾ããTerraformãapplyã³ãã³ããå®è¡ããå¾ã«ãããã®å¤ã表示ãããã¨ãã§ãã¾ãã
以ä¸ã«ãuser_service_cluster moduleã®åºå夿°ã®ä¾ã示ãã¾ãããã®ä¾ã§ã¯ãoutput.tf ã«ã¯ã©ã¹ã¿ã®URLã¨ã¤ã³ã¹ã¿ã³ã¹ã®IDãåºåãã¦ãã¾ãã
output "cluster_url" { description = "The URL of the load balancer for the cluster" value = "http://${google_compute_global_address.default.address}" } output "instance_ids" { description = "The IDs of the instances in the cluster" value = google_compute_instance.default.*.id }
ãããã®åºåãmodule ã®ä½¿ç¨å´ã§ã¢ã¯ã»ã¹ããããã«ã¯ãmoduleã®ååã¨åºåã®ååãçµã¿åããã¦åç §ãã¾ãã
output "user_service_cluster_url" { description = "The URL of the load balancer for the user service cluster" value = module.user_service_cluster.cluster_url } output "user_service_cluster_instance_ids" { description = "The IDs of the instances in the user service cluster" value = module.user_service_cluster.instance_ids }
ãã®ããã«ãã¦ãmoduleã®åºå夿°ã使ç¨ãããã¨ã§ãmoduleã®å é¨ãã¼ã¿ãmoduleå¤é¨ã«å ¬éããä»ã®Terraformã³ã¼ãããã®ãã¼ã¿ãåç §ã§ããããã«ãã¾ããåºå夿°ã¯moduleéã®æ å ±å ±æãå¯è½ã«ããmoduleã®åå©ç¨æ§ãåä¸ããã¾ããTerraformã¯ãã¡ã¤ã«åã«ç¹å¥ãªæå³ãæããã¾ãããããªãã¡ãvariables.tfãoutputs.tfã¨ããååã¯æ £ç¿ã«ãããªãã®ã§ãå ¥å夿°ã¨åºå夿°ã1ã¤ã®ãã¡ã¤ã«ã«ã¾ã¨ãããã¨ãæè¡çã«ã¯å¯è½ã§ãã
module ã使ã£ãã¨ãã®å¤±æã«ã¤ãã¦
module ãä½ãæã«æ³¨æããç¹ã«ã¤ãã¦å®éã«ããã£ããã¨ããã¼ã¹ã«3ã¤ç´¹ä»ãã¾ãã
ãã¼ã¸ã§ã³
Moduleã®ãã¼ã¸ã§ã³ãç°ãªãã¨æå³ããªãæåãã¨ã©ã¼ãå¼ãèµ·ããããå¯è½æ§ãããã®ã§ããã¼ã¸ã§ã³ãåºå®ãå®è¡ç°å¢ãçµ±ä¸ãã¾ããããProviderãããã±ã¼ã¸ã«ãã¦ãåãã§ãã¼ã¸ã§ã³ãæå®ãã¦åå©ç¨æ§ãé«ããï¼ï¼ï¼
ç¶æ ã®å·®åã¯å¯è½ãªéãå°ãããã¹ã
ãã¤ã§ãã¢ããã°ã¬ã¼ããç¶æ å·®åãªãã§è¡ããã¨ã¯ã§ãã¾ãããä¾åãããªã½ã¼ã¹ã®å¤æ´ãã»ãã¥ãªãã£åé¡ãã§ããã ãæ©ãããããé©ç¨ããå¿ è¦ããããªã©ãç ´å£çãªå¤æ´ãå°å ¥ããå¿ è¦ãããå ´åãããã¾ãããã®å ´åãã³ã¹ããã©ã®ããã«æ¸ãããã«ã¤ãã¦èããå¿ è¦ãããã¾ããç¶æ ã®å·®åãå°ãªããã°ãã¢ããã°ã¬ã¼ãã®ã³ã¹ãã¯å°ãªããªãã¾ããç ´å£çãªå¤æ´ãå°å ¥ããã¨ãã¯ããããææ¸åã§ããCHANGELOGãã¦ã¼ã¶ã¼ã¬ã¤ããéãã¦ã¦ã¼ã¶ã¼ã«ä¼ããå¿ è¦ãããã¾ã
ã¢ããã°ã¬ã¼ãã¯èªåãããã¹ã
ã¢ããã°ã¬ã¼ãã¯é·æçã«éçºãããã½ããã¦ã§ã¢ã®æãéè¦ãªã¿ã¹ã¯ã®ä¸ã¤ã§ãããã ããä¸è¬çã«ä½¿ç¨ãããåºã使ç¨ããã¦ããTerraform Moduleã®å ´åãããã¯å¤§ããªåé¡ã§ãããã¾ããã¾ããModuleãé »ç¹ã«æ´æ°ããå ´åãèªåã¢ãããã¼ãã®æ©è½ãæºåããå¿ è¦ãããã¾ããã¦ã¼ã¶ã¼ã«ã¢ããã°ã¬ã¼ããä¾é ¼ãã¦ããé常ãå½¼ãã¯ããéè¦ãªã¿ã¹ã¯ãè¡ãããã«ãããè¡ããã¨ã¯ããã¾ããããã®ããã代ããã«ãå½¼ãã®ããã«PRã使ãã¾ããPRãTerraformã®å·®åããªãå ´åã«èªåçã«ãã¼ã¸ãããã¡ã«ããºã ãæã£ã¦ãã¾ããããã¨å¾æ¹äºææ§ã®ç¶æã®çµã¿åããã«ãããææ°ãã¼ã¸ã§ã³ã®Moduleã使ç¨ããã¦ã¼ã¶ã¼ã®çãå¢ãããã¨ãã§ãã¾ã
ãã¡ã¤ã«ãã¹
Terraformã®templatefile颿°ã使ç¨ããéããã¡ã¤ã«ãã¹ã¯çµ¶å¯¾ãã¹ã§ã¯ãªãç¸å¯¾ãã¹ã使ç¨ããå¿ è¦ãããã¾ããããããããã¯ã©ã®ãã¹ã«å¯¾ãã¦ç¸å¯¾çãªã®ã§ããããï¼
ããã©ã«ãã§ã¯ãTerraformã¯ãã¹ãç¾å¨ã®ä½æ¥ãã£ã¬ã¯ããªã«å¯¾ãã¦ç¸å¯¾çã«è§£éãã¾ãããã®ãããterraform applyãå®è¡ãã¦ãããã£ã¬ã¯ããªã¨åããã£ã¬ã¯ããªã«Terraformè¨å®ãã¡ã¤ã«ãããå ´åãããã¯ãã¾ãåä½ãã¾ããããããå¥ã®ãã©ã«ãã«å®ç¾©ãããmoduleå ã§templatefileã使ç¨ããå ´åãããã¯åé¡ã¨ãªãã¾ãã
ãã®åé¡ã解決ããããã«ã¯ãpath.moduleãªã©ã®ãã¹åç §ã使ç¨ãã¾ããããã使ç¨ããã¨ãmoduleèªä½ã«å¯¾ããç¸å¯¾ãã¹ãå¾ããã¾ãã
ã¤ã³ã©ã¤ã³ãããã¯
Terraformãªã½ã¼ã¹ã®ä¸é¨ã®è¨å®ã¯ãã¤ã³ã©ã¤ã³ãããã¯ãå¥ã®ãªã½ã¼ã¹ã¨ãã¦å®ç¾©ãããã¨ãã§ãã¾ããã¤ã³ã©ã¤ã³ãããã¯ã¨ã¯ããªã½ã¼ã¹å ã§è¨å®ãã弿°ã®ãã¨ã§ã次ã®å½¢å¼ãæã£ã¦ãã¾ãã
resource "xxx" "yyy" { <NAME> { [CONFIG...] } }
ããã§NAMEã¯ã¤ã³ã©ã¤ã³ãããã¯ã®ååï¼ä¾ãã°ãingressï¼ãCONFIGã¯ãã®ã¤ã³ã©ã¤ã³ãããã¯ã«ç¹æã®ä¸ã¤ä»¥ä¸ã®å¼æ°ï¼ä¾ãã°ãfrom_portãto_portï¼ã§ãã
ããããã¤ã³ã©ã¤ã³ãããã¯ã¨å¥ã®ãªã½ã¼ã¹ãæ··å¨ãã¦ä½¿ç¨ããã¨ãTerraformã®è¨è¨ä¸ãè¨å®ãè¡çªãäºãã«ä¸æ¸ãããã¦ã¨ã©ã¼ãçºçãã¾ãããããã£ã¦ãã©ã¡ãã䏿¹ã使ç¨ããå¿ è¦ãããã¾ããmoduleã使ããéã«ã¯ãå¥ã®ãªã½ã¼ã¹ã使ç¨ãããã¨ãå¸¸ã«æ¨å¥¨ãã¾ãã
ãããã®æ³¨æç¹ãçè§£ãã¦ãããã¨ã§ãTerraformã®moduleããã广çã«å©ç¨ãããã¨ãã§ãã¾ãã
ããæãã®ããã©ã«ãã®å¤æ°
å®å ¨ã«ã«ã¹ã¿ãã¤ãºã§ããModuleã«ã¯é åããªãã§ããModuleã®å¤æ°ã«ã¯ã80ï¼ ã®ã¦ã¼ã¶ã¼ãã«ãã¼ããã¹ãã¼ãããã©ã«ãå¤ãæã¤ã¹ãã§ãããã ããåæã«ãé常ã®ã¦ã¼ã¶ã¼ã¨ã¯ç°ãªãæ¹æ³ã§Moduleã使ç¨ãããã¯ã¼ã¦ã¼ã¶ã¼ã®ããã®è¨å®ãç¨æããã¹ãã§ãã夿°ã夿´ããã¨ãã«ä½ãèµ·ãããã¯ãã¦ã¼ã¶ã¼ã«ã¨ã£ã¦æç½ã§äºæ¸¬å¯è½ã§ãªããã°ãªãã¾ããããã®è¨å®ã¯é©åã«è¨è¨ãããå®æã«æµ ãã¤ã³ã¿ã¼ãã§ã¼ã¹ãæã¤ã¹ãã§ã¯ããã¾ãã
æå¾ã«
moduleãæ´»ç¨ãããã¨ã§ãã¤ã³ãã©ã¹ãã©ã¯ãã£ã®åå©ç¨æ§ã¨å¹çæ§ãå¤§å¹ ã«åä¸ãã¾ããéçºè ã¯è¨¼ææ¸ã¿ããã¹ãæ¸ã¿ãææ¸åæ¸ã¿ã®ã¤ã³ãã©ã¹ãã©ã¯ãã£ã®ä¸é¨ãåå©ç¨ã§ããããã«ãªããããè¿ éãã¤ç¢ºå®ã«ã·ã¹ãã ãæ§ç¯ã§ãã¾ããä¾ãã°ããã¤ã¯ããµã¼ãã¹ã®ãããã¤ã¡ã³ããå®ç¾©ããmoduleã使ããåãã¼ã ãæ°è¡ã®ã³ã¼ãã§èªèº«ã®ãã¤ã¯ããµã¼ãã¹ã管çã§ããããã«ãããã¨ãå¯è½ã§ãã
ãããããã®ãããªmoduleãè¤æ°ã®ãã¼ã ã§æ´»ç¨ããããã«ã¯ãmoduleå ã®Terraformã³ã¼ãã¯æè»æ§ã¨è¨å®å¯è½æ§ãå¿ è¦ã§ããç°ãªããã¼ã ãç¶æ³ã«å¿ãã¦ããã¼ããã©ã³ãµã¼ãªãã®åä¸ã¤ã³ã¹ã¿ã³ã¹ããã¼ããã©ã³ãµã¼ä»ãã®è¤æ°ã¤ã³ã¹ã¿ã³ã¹ã¨ãã£ãããã¾ãã¾ãªãããã¤ã¡ã³ãè¦ä»¶ãæºãããã¨ãã§ãã¾ããTerraformã®æè»ãªæ§æãæ´»ç¨ãããã¨ã§ããã夿©è½ãªmoduleãè¨è¨ããã¤ã³ãã©ã¹ãã©ã¯ãã£ã®æ§ç¯ãä¸å±¤æ¥½ãã广çã«è¡ããã¨ãã§ãã¾ããã¾ããã©ããããã®è¦æ¨¡ããmoduleåããã®ããªã©è¿·ãå ´é¢ãå¤ãã¨æãã¾ãããã®è¾ºã¯çµé¨ã¨ããè¨ããã«ã¿ããªé°å²æ°ã§ãã£ã¦ãããªãã£ã¦æãã¾ããã
ãã®ããã°ã伸ã³ãããã£ã¨å®è£ ã«åºã¥ãã話ããã¦ãããã¨æãã¾ããã¡ãªã¿ã«ãã¹ããã©ã¯ãã£ã¹ãªããã¯ä¿ºã«ã¯ããããªããèªåãä¿¡ãã¦ãâ¦ä¿¡é ¼ã«è¶³ã仲éãä¿¡ãã¦ãâ¦èª°ã«ãããããªãâ¦ä»ã®æ§æãä¸çªå¤æ´ããããã¦èªãããã®ãªããããæ£è§£ãªãã ã¨ãããã
