Skip to content
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
2 changes: 1 addition & 1 deletion cli/templatecreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(&parameterFile, "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")
Expand Down
2 changes: 1 addition & 1 deletion coderd/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 17 additions & 1 deletion examples/templates/aws-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 = {
Expand Down
18 changes: 17 additions & 1 deletion examples/templates/aws-windows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down