ã¯ããã« ããã«ã¡ã¯ãã¯ãã¹ ã€ãããŒã·ã§ã³ æ¬éšãšã³ãžãã¢ãªã³ã°ãã¯ãã ãžãŒ ã»ã³ã¿ãŒãæ°å1幎ç®ã®å€§å²¡å¡ã§ãã ä»åã¯ãTerraformã§Auto Scaling Groupã®æåã«æ©ãã çµéšããã£ããã«ã AWS Providerãåèã«ããªããCustom Providerãå®è£
ããŠã¿ã話ãã玹ä»ããŸããå®è£
ãéããŠãTerraform Providerã®æ§é ãæ¡åŒµã®ä»çµã¿ãçè§£ããããšãã§ããŸããã ã¯ããã« Terraformãšã¯ Terraform Providerãšã¯ Custom Providerãå®è£
ããã¢ãããŒã·ã§ã³ Custom Providerã®å®è£
ç®æšãšæ¹é ãã£ã¬ã¯ããªã»ãã¡ã€ã«æ§æ ãœãŒã¹ã³ãŒãå
šäœ ãã«ããšèšå® Custom Providerã§ãªãœãŒã¹ãäœã£ãçµæ ãŸãšã Terraformãšã¯ ç§ã¯Terraformã10æã«éšçœ²é
å±ãããŠåããŠç¥ã£ãã®ã§ãç¥ããªãæ¹ã®ããã«ãŸãã¯ç°¡åã«Terraformã«ã€ããŠèª¬æããŸãã Terraformãšã¯ãHashiCorp瀟ãæäŸãã ãã«ã ã¯ã©ãŠã 察å¿ã®IaCïŒInfrastructure as CodeïŒããŒã« ã§ãã AWS ãAzureã Google Cloudãªã©æ§ã
㪠ã¯ã©ãŠã ãªãœãŒã¹ãã³ãŒãã§æ§ç¯ã§ããŸãã äŸãã°ã AWS ã§æ±äº¬ãªãŒãžã§ã³ã« VPC ãäœãå Žåã¯ä»¥äžã®ãšããã§ãã Terraform Providerãšã¯ Terraformå
¬åŒãµã€ã ã§ã¯ãProviderã«ã€ããŠä»¥äžã®ããã«èª¬æããŠããŸãã Terraform relies on plugins called providers to interact with cloud providers, SaaS providers, and other APIs. Terraform configurations must declare which providers they require so that Terraform can install and use them. Additionally, some providers require configuration (like endpoint URLs or cloud regions) before they can be used. ïŒTerraformå
¬åŒãµã€ãããåŒçšïŒ èŠããã«ãTerraform Providerãšã¯Terraformãšå€éšãµãŒãã¹ãã€ãªãããã® ãã©ã°ã€ã³ ã§ããTerraformãã®ãã®ã¯ãªãœãŒã¹å®çŸ©ãç¶æ
管çãè¡ããå®éã« ã¯ã©ãŠã ãšéä¿¡ããŠãªãœãŒã¹ãäœæã»å€æŽããã®ã¯Providerã®åœ¹å²ã§ãã äŸãã°ãTerraformã AWS äžã«ãªãœãŒã¹ãæ§ç¯ããå Žåã®å€§ãŸããªæµãã¯æ¬¡ã®ããã«ãªããŸãã ãŠãŒã¶ãŒãTerraformã³ãŒãïŒHCLïŒã§ãªãœãŒã¹ãå®çŸ© Terraformã察å¿ããProviderãããŠã³ããŒã Providerã AWS SDK ïŒGoèšèªçšã® AWS å
¬åŒã©ã€ãã©ãªïŒã䜿ã£ãŠã AWS API ãåŒã³åºã API ã®ã¬ã¹ãã³ã¹ãå å·¥ããTerraformã®ã¹ããŒããã¡ã€ã«ïŒ terraform.tfstate ïŒã«åæ ãã äž»èŠãª ã¯ã©ãŠã ã®Terraform Providerã¯ã GitHub ã§ ãªãŒãã³ãœãŒã¹ ãšããŠå
¬éãããŠãããå®è£
ã®è©³çްã確èªããããšãã§ããŸãã Terraform AWS ProviderïŒ https://github.com/hashicorp/terraform-provider-aws Terraform Provider for Azure (Resource Manager)ïŒ https://github.com/hashicorp/terraform-provider-azurerm Terraform Provider for Google Cloud PlatformïŒ https://github.com/hashicorp/terraform-provider-google ãŸããProviderã¯èªäœããããšãå¯èœã§ãããèªäœããProviderã®ããšãCustom ProviderãšåŒã³ãŸãã Custom Providerãå®è£
ããã¢ãããŒã·ã§ã³ Terraformã䜿ãå§ããã°ããã®ããæ¥ãAuto Scaling GroupïŒASGïŒã®æ§ç¯ã«åãçµãã§ããŸããã ãŸãã¯ã以äžã®ã³ãŒãã§ASGãäœæããŸããã resource "aws_launch_template" "main" {  name_prefix = "main"  image_id   = "ami-01205c30badb279ecâ  instance_type = " t2.micro " } resource " aws_autoscaling_group " " main " {  name         = " main "  max_size       = 3  desired_capacity   = 2  min_size       = 1  health_check_type  = " EC2 "  vpc_zone_identifier = [aws_subnet.main.id, aws_subnet.secondary.id]  launch_template {   id = aws_launch_template.main.id  } } åé¡ã¯ããããã§ãã èµ·åãã³ãã¬ãŒãã«ã»ãã¥ãªãã£ã°ã«ãŒãïŒSGïŒã®èšå®ãå
¥ãå¿ããŠããããšã«æ°ã¥ãã以äžã®ããã«ä¿®æ£ããŸããã resource "aws_launch_template" "main" {  name_prefix  = "main"  image_id    = "ami-01205c30badb279ec"  instance_type = "t2.micro"  vpc_security_group_ids = [ var.ec2_security_group_id ] #SGã远å } èµ·åãã³ãã¬ãŒãã®èšå®ãåæ ãããããã«å床 terraform apply ãå®è¡ããåŸããããžã¡ã³ãã³ã³ãœãŒã«ã§ASG管çäžã®EC2 ã€ã³ã¹ã¿ã³ã¹ ããã¹ãŠåé€ããASGã«æ°ãã ã€ã³ã¹ã¿ã³ã¹ ãèµ·åãããŸããã ããããèµ·åãã ã€ã³ã¹ã¿ã³ã¹ ã確èªãããš default ã®SGãèšå®ãããŠããã远å ããSGãåæ ãããŠããŸããã§ããã Terraformåå¿è
ã ã£ãç§ã¯ãåŠç¿ã®ããã«çæAIã䜿çšããªãçžããèªåã«èª²ããŠããããšããããåå ã®ç¹å®ã«1æéã»ã©ããã£ãŠããŸããŸãããæçµçã«ãåå ã¯ä»¥äžã® AWS Providerã®ä»æ§ã ãšããããšãåãããŸããã aws_autoscaling_group ãªãœãŒã¹ã® launch_template ãããã¯ã§ version ãæå®ããªãå ŽåãASGã¯åžžã« Default ããŒãžã§ã³ãåç
§ãã aws_launch_template ãªãœãŒã¹ã«ãã㊠default_version ã update_default_version ãšãã£ãåŒæ°ã§ Default ããŒãžã§ã³ã®èšå®ãããªãéããæåã«äœæãããããŒãžã§ã³1ãåç
§ããç¶ãã ã€ãŸããASGã«èµ·åãã³ãã¬ãŒãã®æŽæ°å
容ãåæ ãããã«ã¯ã version = "$Latest" ãæç€ºçã«æå®ããå¿
èŠããã£ãã®ã§ãã resource "aws_autoscaling_group" "main" { name = "main" ... launch_template { id = aws_launch_template.main.id version = "$Latest" # â ãããæç€ºããå¿
èŠããã£ãïŒ } } ãã®ä»æ§ãçè§£ãããšãããããã©ã«ãã§ Latest ã䜿ã£ãŠããããããã®ã«âŠâŠããšçŽæçã«æããŸããã äžæ¹ã§ãProviderã®ä»æ§ãšããŠã¯ä»¥äžã®ãããªçç±ãã劥åœã ãšãæããŸããã éçšäžãæå³çã« Default ã§åºå®ãããã±ãŒã¹ããã AWS ãããžã¡ã³ãã³ã³ãœãŒã«ã§ãASGäœææã®åæå€ã¯ Default(1) ãšãªã£ãŠãã ãããŠãã¡ããã©ãã®é ã«Providerãèªäœã§ããããšãç¥ã£ãããšããããã versionãããã©ã«ãã§ $Latest ã«ããŠãããProviderãèªåã§äœã£ãŠå匷ããŠã¿ãã ããšæ±ºæããŸããã ããããä»åã®Custom Providerå®è£
ã®ã¢ãããŒã·ã§ã³ã§ãã Custom Providerã®å®è£
ç®æšãšæ¹é ä»åäœã£ãCustom Providerã¯ã awsmini ããšããååã§ã次ã®ãããªæ¹éã§äœããŸããã aws_autoscaling_group ãš aws_launch_template ã®ã¿ããµããŒã aws_autoscaling_group ã® launch_template ãããã¯ã® version ã®ããã©ã«ãå€ã $Latest ã«èšå® ããŒã«ã«ã§ãã«ãããŠãTerraformã«çŽæ¥èªã¿èŸŒãŸããæ¹åŒãæ¡çš å®è£
㯠å
¬åŒAWS Providerã®GitHubãªããžã㪠ãåèã«ããŸããã ãã£ã¬ã¯ã ãªã»ãã¡ã€ã«æ§æ ãã£ã¬ã¯ã ãªã»ãã¡ã€ã«æ§æã¯ä»¥äžã®ãšããã§ãã ããããã®ãã¡ã€ã«ã¯ã衚1ã«ç€ºãããã«å
¬åŒ ãªããžã㪠ãåèã«ããŠå®è£
ããŸããã awsmini/ âââ bin/ # ãã«ãææç© âââ internal/ â âââ provider/provider.go # Providerå®çŸ© â âââ conns/ â â âââ awsclient.go # AWSã¯ã©ã€ã¢ã³ãçæã»ãã£ãã·ã¥ â â âââ config.go # AWSèªèšŒæ
å ±èšå® â âââ service/ â âââ autoscaling/group.go # ASGãªãœãŒã¹å®è£
â âââ ec2/launch_template.go # Launch TemplateãªãœãŒã¹å®è£
âââ main.go # ãšã³ããªãã€ã³ã 衚1. awsminiå
ã®ãã¡ã€ã«ãšå
¬åŒ AWS Providerã®å¯Ÿå¿é¢ä¿ awsmini ãã¡ã€ã« å
¬åŒ ãªããžã㪠å
ã®åèãã¡ã€ã« main.go main.go internal/provider/provider.go internal/provider/sdkv2/provider.go internal/conns/awsclient.go internal/conns/awsclient.go internal/conns/config.go internal/conns/config.go internal/service/autoscaling/group.go internal/service/autoscaling/group.go internal/service/ec2/launch_template.go internal/service/ec2/ec2_launch_template.go â»æ³šæïŒäžèšãªã³ã¯å
ã® ãœãŒã¹ã³ãŒã ã¯ãä»åŸã®Providerã¢ããããŒãã«ããã³ãŒãæ§é ã倿Žãããå¯èœæ§ããããŸãã ãã®ãããå·çæç¹ïŒ2025幎11æïŒã§ã®åèæ
å ±ãšããŠã芧ãã ããã ãŸãã group.go å
ã§ aws_autoscaling_group ã® launch_template ãããã¯ã® version åŒæ°ã®ããã©ã«ãå€ã $Latest ã«èšå®ããŸããã "launch_template" : { Type: schema.TypeList, Optional: true , MaxItems: 1 , Elem: &schema.Resource{ Schema: map [ string ]*schema.Schema{ "id" : { Type: schema.TypeString, Optional: true , Computed: true , }, "name" : { Type: schema.TypeString, Optional: true , Computed: true , }, "version" : { Type: schema.TypeString, Optional: true , Default: "$Latest" , // ããã§ããã©ã«ãå€ãLatestã«èšå® }, }, }, }, ãœãŒã¹ã³ãŒã å
šäœ group.go ãš launch_template.go ã®ã³ãŒãã¯åéãå€ããããããã§ã¯ãã以å€ã®ãã¡ã€ã«ã®ã¿ãæ²èŒããŸãã åæãšããŠã awsmini ãã£ã¬ã¯ã ãªã§ä»¥äžã®ã³ãã³ããå®è¡ããŸããïŒã³ãã³ãå
ã® ãªããžã㪠ã¯å®éã«ååšãããã®ã§ã¯ãããŸããïŒã go mod init github.com/torut/terraform-provider-awsmini awsmini/main.go // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "context" "flag" "log" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" "github.com/torut/terraform-provider-awsmini/internal/provider" ) func main() { var debugMode bool flag.BoolVar(&debugMode, "debug" , false , "set to true to run the provider with support for debuggers like delve" ) flag.Parse() opts := &plugin.ServeOpts{ ProviderFunc: func () *schema.Provider { ctx := context.Background() p, err := provider.New(ctx) if err != nil { log.Fatalf( "failed to create provider: %v" , err) } return p }, } if debugMode { ctx := context.Background() err := plugin.Debug(ctx, "local/awsmini" , opts) if err != nil { log.Fatalf( "failed to serve provider in debug mode: %v" , err) } return } plugin.Serve(opts) } awsmini/internal/provider/provider.go // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package provider import ( "context" "fmt" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/torut/terraform-provider-awsmini/internal/conns" "github.com/torut/terraform-provider-awsmini/internal/service/autoscaling" "github.com/torut/terraform-provider-awsmini/internal/service/ec2" ) // New returns a new, initialized Terraform Plugin SDK v2-style provider instance. // The provider instance is fully configured once the ConfigureContextFunc has been called. func New(ctx context.Context) (*schema.Provider, error ) { provider := &schema.Provider{ Schema: map [ string ]*schema.Schema{ "access_key" : { Type: schema.TypeString, Optional: true , Description: "The access key for API operations. You can retrieve this from the 'Security & Credentials' section of the AWS console." , }, "profile" : { Type: schema.TypeString, Optional: true , Description: "The profile for API operations. If not set, the default profile created with `aws configure` will be used." , }, "region" : { Type: schema.TypeString, Optional: true , Description: "The region where AWS operations will take place. Examples are us-east-1, us-west-2, etc." , }, "secret_key" : { Type: schema.TypeString, Optional: true , Description: "The secret key for API operations. You can retrieve this from the 'Security & Credentials' section of the AWS console." , }, "shared_config_files" : { Type: schema.TypeList, Optional: true , Description: "List of paths to shared config files. If not set, defaults to [~/.aws/config]." , Elem: &schema.Schema{Type: schema.TypeString}, }, "shared_credentials_files" : { Type: schema.TypeList, Optional: true , Description: "List of paths to shared credentials files. If not set, defaults to [~/.aws/credentials]." , Elem: &schema.Schema{Type: schema.TypeString}, }, "skip_credentials_validation" : { Type: schema.TypeBool, Optional: true , Description: "Skip the credentials validation via STS API. Used for AWS API implementations that do not have STS available/implemented." , }, "skip_region_validation" : { Type: schema.TypeBool, Optional: true , Description: "Skip static validation of region name. Used by users of alternative AWS-like APIs or users w/ access to regions that are not public (yet)." , }, "skip_requesting_account_id" : { Type: schema.TypeBool, Optional: true , Description: "Skip requesting the account ID. Used for AWS API implementations that do not have IAM/STS API and/or metadata API." , }, "token" : { Type: schema.TypeString, Optional: true , Description: "Session token for temporary credentials." , }, }, // Resources ResourcesMap: map [ string ]*schema.Resource{ "awsmini_autoscaling_group" : autoscaling.ResourceGroup(), "awsmini_launch_template" : ec2.ResourceLaunchTemplate(), }, DataSourcesMap: map [ string ]*schema.Resource{}, } provider.ConfigureContextFunc = func (ctx context.Context, d *schema.ResourceData) ( interface {}, diag.Diagnostics) { return configure(ctx, d, provider.TerraformVersion) } return provider, nil } // configure initializes the AWS client func configure(ctx context.Context, d *schema.ResourceData, terraformVersion string ) ( interface {}, diag.Diagnostics) { var diags diag.Diagnostics if terraformVersion == "" { terraformVersion = "0.11+compatible" } config := conns.Config{ AccessKey: d.Get( "access_key" ).( string ), Profile: d.Get( "profile" ).( string ), Region: d.Get( "region" ).( string ), SecretKey: d.Get( "secret_key" ).( string ), SkipCredsValidation: d.Get( "skip_credentials_validation" ).( bool ), SkipRegionValidation: d.Get( "skip_region_validation" ).( bool ), SkipRequestingAccountId: d.Get( "skip_requesting_account_id" ).( bool ), TerraformVersion: terraformVersion, Token: d.Get( "token" ).( string ), } // Handle shared config files if v, ok := d.GetOk( "shared_config_files" ); ok && len (v.([] interface {})) > 0 { config.SharedConfigFiles = expandStringList(v.([] interface {})) } // Handle shared credentials files if v, ok := d.GetOk( "shared_credentials_files" ); ok && len (v.([] interface {})) > 0 { config.SharedCredentialsFiles = expandStringList(v.([] interface {})) } // Initialize the AWS client client, err := config.ConfigureProvider(ctx) if err != nil { return nil , diag.FromErr(fmt.Errorf( "error configuring AWS provider: %w" , err)) } return client, diags } // expandStringList expands a list of interfaces to a list of strings func expandStringList(configured [] interface {}) [] string { vs := make ([] string , 0 , len (configured)) for _, v := range configured { val, ok := v.( string ) if ok && val != "" { vs = append (vs, val) } } return vs } awsmini/internal/conns/awsclient.go // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package conns import ( "context" "sync" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/autoscaling" "github.com/aws/aws-sdk-go-v2/service/ec2" ) // AWSClient holds the AWS SDK clients type AWSClient struct { awsConfig *aws.Config region string lock sync.Mutex // Service clients (cached) autoscalingClient *autoscaling.Client ec2Client *ec2.Client } // AwsConfig returns a copy of the AWS configuration func (c *AWSClient) AwsConfig(context.Context) aws.Config { return c.awsConfig.Copy() } // Region returns the configured AWS Region func (c *AWSClient) Region(context.Context) string { return c.region } // AutoScalingClient returns the Auto Scaling service client func (c *AWSClient) AutoScalingClient(ctx context.Context) *autoscaling.Client { c.lock.Lock() defer c.lock.Unlock() if c.autoscalingClient == nil { c.autoscalingClient = autoscaling.NewFromConfig(*c.awsConfig) } return c.autoscalingClient } // EC2Client returns the EC2 service client func (c *AWSClient) EC2Client(ctx context.Context) *ec2.Client { c.lock.Lock() defer c.lock.Unlock() if c.ec2Client == nil { c.ec2Client = ec2.NewFromConfig(*c.awsConfig) } return c.ec2Client } awsmini/internal/conns/config.go // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package conns import ( "context" "fmt" "time" awsbase "github.com/hashicorp/aws-sdk-go-base/v2" basediag "github.com/hashicorp/aws-sdk-go-base/v2/diag" "github.com/hashicorp/aws-sdk-go-base/v2/logging" ) // Config holds the provider configuration type Config struct { AccessKey string Profile string Region string SecretKey string SharedConfigFiles [] string SharedCredentialsFiles [] string SkipCredsValidation bool SkipRegionValidation bool SkipRequestingAccountId bool TerraformVersion string Token string } // ConfigureProvider configures and returns an AWS client func (c *Config) ConfigureProvider(ctx context.Context) (*AWSClient, error ) { ctx, logger := logging.NewTfLogger(ctx) const maxBackoff = 300 * time.Second awsbaseConfig := awsbase.Config{ AccessKey: c.AccessKey, APNInfo: &awsbase.APNInfo{ PartnerName: "HashiCorp" , Products: []awsbase.UserAgentProduct{ {Name: "Terraform" , Version: c.TerraformVersion, Comment: "+https://www.terraform.io" }, {Name: "terraform-provider-awsmini" , Version: "0.0.1" , Comment: "+https://github.com/torut/terraform-provider-awsmini" }, }, }, CallerDocumentationURL: "https://github.com/torut/terraform-provider-awsmini" , CallerName: "Terraform AWS Mini Provider" , Logger: logger, MaxBackoff: maxBackoff, MaxRetries: 25 , Profile: c.Profile, Region: c.Region, SecretKey: c.SecretKey, SkipCredsValidation: c.SkipCredsValidation, SkipRequestingAccountId: c.SkipRequestingAccountId, Token: c.Token, } if len (c.SharedConfigFiles) != 0 { awsbaseConfig.SharedConfigFiles = c.SharedConfigFiles } if len (c.SharedCredentialsFiles) != 0 { awsbaseConfig.SharedCredentialsFiles = c.SharedCredentialsFiles } // Get AWS configuration ctx, cfg, awsDiags := awsbase.GetAwsConfig(ctx, &awsbaseConfig) if awsDiags.HasError() { return nil , fmt.Errorf( "error configuring AWS: %s" , diagsToString(awsDiags)) } // Create AWS client client := &AWSClient{ awsConfig: &cfg, region: c.Region, } return client, nil } // diagsToString converts diagnostics to a string func diagsToString(diags basediag.Diagnostics) string { var result string for _, d := range diags { if result != "" { result += "; " } result += fmt.Sprintf( "%s: %s" , d.Summary(), d.Detail()) } return result } ãã«ããšèšå® awsmini ãã£ã¬ã¯ã ãªã§ä»¥äžã®ã³ãã³ããå®è¡ããŸãã go build -o .\bin\terraform-provider-awsmini_v0.0.1.exe . é©åãªå ŽæïŒ Windows ãªããŠãŒã¶ãŒã® %APPDATA% ãã£ã¬ã¯ã ãªã Mac ãªããŠãŒã¶ãŒã®ããŒã ãã£ã¬ã¯ã ãªïŒã« terraform.rc ãšãããã¡ã€ã«ãäœæããŠä»¥äžã®å
容ãèšè¿°ããŸãã provider_installation { dev_overrides { "local/awsmini" = "C:\\Users\\torut\\Desktop\\awsmini\\bin" } } ããã«ãããTerraformã local/awsmini ãããã€ããŒãæå®ãããããŒã«ã«ãã¹ããèªã¿èŸŒãããã«ãªããŸããïŒåèïŒ Create a Terraform CLI configuration file ïŒ dev_overridesã ãš terraform init ã䜿çšã§ããªãããæ³šæããŠãã ããã filesystem_mirrorãæå®ããã°ã terraform init ã䜿çšããŠããŒã«ã«ã®ãããã€ããŒãåç
§ã§ããŸãã Custom Providerã§ãªãœãŒã¹ãäœã£ãçµæ 以äžã®ã³ãŒããå®è¡ããŠASGãäœæããŸããã terraform { required_version = ">= 1.6.0" required_providers { awsmini = { source = "local/awsmini" version = "0.0.1" } } } provider "awsmini" { region = "ap-northeast-1" } resource "awsmini_launch_template" "example" { name_prefix = "awsmini-lt-" image_id = "ami-0d52744d6551d851e" instance_type = "t3.micro" } resource "awsmini_autoscaling_group" "example" { name = "awsmini-asg-example" max_size = 3 desired_capacity = 2 min_size = 1 health_check_type = "EC2" vpc_zone_identifier = [ "subnet-0fcd0acfe38968bb2" , "subnet-017fa0e9eb9e46c84" ] launch_template { id = awsmini_launch_template.example.id # versionã¯æªæå® } } å®è¡ããçµæãversionæªæå®ã§ASGã®èµ·åãã³ãã¬ãŒãã®ããŒãžã§ã³ã $Latest ãšããŠèšå®ãããŠããããšã確èªããŸããã terraform plan ã®åºåïŒäžéšïŒ Terraform will perform the following actions: # awsmini_autoscaling_group.example will be created + resource "awsmini_autoscaling_group" "example" { + arn = (known after apply) + default_cooldown = (known after apply) + desired_capacity = 2 + health_check_grace_period = 300 + health_check_type = "EC2" + id = (known after apply) + max_size = 3 + min_size = 1 + name = "awsmini-asg-example" + vpc_zone_identifier = [ + "subnet-017fa0e9eb9e46c84", + "subnet-0fcd0acfe38968bb2", ] + launch_template { + id = (known after apply) + name = (known after apply) + version = "$Latest" } } ãããžã¡ã³ãã³ã³ãœãŒã« ãŸãšã ä»åã¯ãå
¬åŒã® AWS Providerãåèã«Custom Providerãå®è£
ãã aws_autoscaling_group ã® launch_template ãããã¯ã® version ãããã©ã«ãã§ $Latest ã«èšå®ã§ããããã«ããŸããã å®è£
ãéããŠãTerraform Providerã®å
éšæ§é ãä»çµã¿ãçè§£ããå
¬åŒ ãªããžã㪠ãèªã¿è§£ããªããæ¡åŒµããçµéšãåŸãããŸããã ä»åŸã AWS Provider ã«èª²é¡ãæããéã¯ãä»åã®çµéšã掻ãã㊠Custom Provider ãå®è£
ããããšã§èª²é¡ã解決ããããããã«çè§£ãæ·±ãŸãã° AWS Provider ãžã®ã³ã³ããªãã¥ãŒãã«ãææŠããŠã¿ãããšæããŸãã ãã®èšäºããCustom Provider å®è£
ã«åãçµãæ¹ã®äžå©ã«ãªãã°å¹žãã§ãã ãããŸã§ãèªã¿ããã ããããããšãããããŸããã ç§ãã¡ã¯äžç·ã«åããŠããã仲éãåéããŠããŸãïŒ é»éç·ç ãã£ãªã¢æ¡çšãµã€ã é»éç·ç æ°åæ¡çšãµã€ã å·çïŒ @ooka.toru ã¬ãã¥ãŒïŒ @miyazawa.hibiki ïŒ Shodo ã§å·çãããŸãã ïŒ