Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up automatic pull for EC2 instance types #958

Merged
merged 2 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ecs-cli/modules/cli/cluster/cluster_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ type AWSClients struct {
ECSClient ecsclient.ECSClient
CFNClient cloudformation.CloudformationClient
AMIMetadataClient amimetadata.Client
EC2Client ec2client.EC2Client
}

func newAWSClients(commandConfig *config.CommandConfig) *AWSClients {
ecsClient := ecsclient.NewECSClient(commandConfig)
cfnClient := cloudformation.NewCloudformationClient(commandConfig)
metadataClient := amimetadata.NewMetadataClient(commandConfig)
ec2Client := ec2client.NewEC2Client(commandConfig)

return &AWSClients{ecsClient, cfnClient, metadataClient}
return &AWSClients{ecsClient, cfnClient, metadataClient, ec2Client}
}

///////////////////////
Expand Down Expand Up @@ -343,7 +345,11 @@ func createCluster(context *cli.Context, awsClients *AWSClients, commandConfig *
}
}
// Create cfn stack
template, err := cloudformation.GetClusterTemplate(tags, stackName)
instanceTypes, err := awsClients.EC2Client.DescribeInstanceTypeOfferings(commandConfig.Region())
if err != nil {
return errors.Wrapf(err, "No instance type found in region %s", commandConfig.Region())
}
template, err := cloudformation.GetClusterTemplate(tags, stackName, instanceTypes)
if err != nil {
return errors.Wrapf(err, "Error building cloudformation template")
}
Expand Down
Loading