mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
change default aws linux instance type to t3.micro, reduce default template TTL (#2776)
- make default template max TTL 24 hours (still less than 168) - make default workspace autostop 2 hours unless specified otherwise - add instance type selector to aws templates
This commit is contained in:
@ -127,7 +127,7 @@ func templateCreate() *cobra.Command {
|
||||
cmd.Flags().StringVarP(&directory, "directory", "d", currentDirectory, "Specify the directory to create from")
|
||||
cmd.Flags().StringVarP(&provisioner, "test.provisioner", "", "terraform", "Customize the provisioner backend")
|
||||
cmd.Flags().StringVarP(¶meterFile, "parameter-file", "", "", "Specify a file path with parameter values.")
|
||||
cmd.Flags().DurationVarP(&maxTTL, "max-ttl", "", 168*time.Hour, "Specify a maximum TTL for workspaces created from this template.")
|
||||
cmd.Flags().DurationVarP(&maxTTL, "max-ttl", "", 24*time.Hour, "Specify a maximum TTL for workspaces created from this template.")
|
||||
cmd.Flags().DurationVarP(&minAutostartInterval, "min-autostart-interval", "", time.Hour, "Specify a minimum autostart interval for workspaces created from this template.")
|
||||
// This is for testing!
|
||||
err := cmd.Flags().MarkHidden("test.provisioner")
|
||||
|
@ -32,7 +32,7 @@ import (
|
||||
"github.com/coder/coder/codersdk"
|
||||
)
|
||||
|
||||
const workspaceDefaultTTL = 12 * time.Hour
|
||||
const workspaceDefaultTTL = 2 * time.Hour
|
||||
|
||||
func (api *API) workspace(rw http.ResponseWriter, r *http.Request) {
|
||||
workspace := httpmw.WorkspaceParam(r)
|
||||
|
@ -36,6 +36,22 @@ variable "region" {
|
||||
}
|
||||
}
|
||||
|
||||
variable "instance_type" {
|
||||
description = "What instance type should your workspace use?"
|
||||
default = "t3.micro"
|
||||
validation {
|
||||
condition = contains([
|
||||
"t3.micro",
|
||||
"t3.small",
|
||||
"t3.medium",
|
||||
"t3.large",
|
||||
"t3.xlarge",
|
||||
"t3.2xlarge",
|
||||
], var.instance_type)
|
||||
error_message = "Invalid instance type!"
|
||||
}
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
region = var.region
|
||||
}
|
||||
@ -130,7 +146,7 @@ EOT
|
||||
resource "aws_instance" "dev" {
|
||||
ami = data.aws_ami.ubuntu.id
|
||||
availability_zone = "${var.region}a"
|
||||
instance_type = "t3.xlarge"
|
||||
instance_type = "${var.instance_type}"
|
||||
|
||||
user_data = data.coder_workspace.me.transition == "start" ? local.user_data_start : local.user_data_end
|
||||
tags = {
|
||||
|
@ -36,6 +36,22 @@ variable "region" {
|
||||
}
|
||||
}
|
||||
|
||||
variable "instance_type" {
|
||||
description = "What instance type should your workspace use?"
|
||||
default = "t3.micro"
|
||||
validation {
|
||||
condition = contains([
|
||||
"t3.micro",
|
||||
"t3.small",
|
||||
"t3.medium",
|
||||
"t3.large",
|
||||
"t3.xlarge",
|
||||
"t3.2xlarge",
|
||||
], var.instance_type)
|
||||
error_message = "Invalid instance type!"
|
||||
}
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
region = var.region
|
||||
}
|
||||
@ -83,7 +99,7 @@ EOT
|
||||
resource "aws_instance" "dev" {
|
||||
ami = data.aws_ami.windows.id
|
||||
availability_zone = "${var.region}a"
|
||||
instance_type = "t3.micro"
|
||||
instance_type = "${var.instance_type}"
|
||||
count = 1
|
||||
|
||||
user_data = data.coder_workspace.me.transition == "start" ? local.user_data_start : local.user_data_end
|
||||
|
Reference in New Issue
Block a user