From dbede4eb7e54c4bb43fef7caa0e7fbca95af9b9a Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 25 Aug 2023 09:43:33 +0300 Subject: [PATCH 1/3] chore: update aws_linux template Updated the template with the following changes 1. use https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_instance_state.html to manage start/stop 2. Update agent metadata to use `coder stat` 3. Update some wrong regional flag emojis --- examples/templates/aws-linux/main.tf | 77 +++++++++++++--------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index 96d9136dfe758..fdb69eb6c2d3e 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { coder = { source = "coder/coder" - version = "~> 0.7.0" + version = "~> 0.11.0" } aws = { source = "hashicorp/aws" @@ -30,24 +30,24 @@ data "coder_parameter" "region" { icon = "/emojis/1f1f0-1f1f7.png" } option { - name = "Asia Pacific (Osaka-Local)" + name = "Asia Pacific (Osaka)" value = "ap-northeast-3" - icon = "/emojis/1f1f0-1f1f7.png" + icon = "/emojis/1f1ef-1f1f5.png" } option { name = "Asia Pacific (Mumbai)" value = "ap-south-1" - icon = "/emojis/1f1f0-1f1f7.png" + icon = "/emojis/1f1ee-1f1f3.png" } option { name = "Asia Pacific (Singapore)" value = "ap-southeast-1" - icon = "/emojis/1f1f0-1f1f7.png" + icon = "/emojis/1f1f8-1f1ec.png" } option { name = "Asia Pacific (Sydney)" value = "ap-southeast-2" - icon = "/emojis/1f1f0-1f1f7.png" + icon = "/emojis/1f1e6-1f1fa.png" } option { name = "Canada (Central)" @@ -176,33 +176,21 @@ resource "coder_agent" "main" { display_name = "CPU Usage" interval = 5 timeout = 5 - script = <<-EOT - #!/bin/bash - set -e - top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4 "%"}' - EOT + script = "coder stat cpu" } metadata { key = "memory" display_name = "Memory Usage" interval = 5 timeout = 5 - script = <<-EOT - #!/bin/bash - set -e - free -m | awk 'NR==2{printf "%.2f%%\t", $3*100/$2 }' - EOT + script = "coder stat mem" } metadata { key = "disk" display_name = "Disk Usage" interval = 600 # every 10 minutes timeout = 30 # df can take a while on large filesystems - script = <<-EOT - #!/bin/bash - set -e - df /home/coder | awk '$NF=="/"{printf "%s", $5}' - EOT + script = "coder stat disk --path $HOME" } } @@ -257,30 +245,30 @@ sudo -u ${local.linux_user} sh -c '${coder_agent.main.init_script}' --//-- EOT - user_data_end = < Date: Fri, 25 Aug 2023 07:04:58 +0000 Subject: [PATCH 2/3] fmt --- examples/templates/aws-linux/main.tf | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index fdb69eb6c2d3e..ce1c2ea885335 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -245,30 +245,30 @@ sudo -u ${local.linux_user} sh -c '${coder_agent.main.init_script}' --//-- EOT -# user_data_end = < Date: Fri, 25 Aug 2023 13:46:55 +0000 Subject: [PATCH 3/3] PR comments --- examples/templates/aws-linux/main.tf | 40 ++++------------------------ 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index ce1c2ea885335..f1f41024d938a 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -211,11 +211,9 @@ resource "coder_app" "code-server" { } locals { - - # User data is used to stop/start AWS instances. See: - # https://github.com/hashicorp/terraform-provider-aws/issues/22 - - user_data_start = < pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy