From afaefe34b9156e541759cda50006b75c4a6b1b7e Mon Sep 17 00:00:00 2001 From: phillhocking Date: Wed, 9 Feb 2022 15:04:11 -0800 Subject: [PATCH] 1.20 release branch --- backend.tf | 2 +- main.tf | 8 ++++---- outputs.tf | 2 +- security_groups.tf | 9 +++------ tig.sh | 28 ---------------------------- 5 files changed, 9 insertions(+), 40 deletions(-) delete mode 100644 tig.sh diff --git a/backend.tf b/backend.tf index 96302dd..8c4ae07 100644 --- a/backend.tf +++ b/backend.tf @@ -4,7 +4,7 @@ terraform { organization = "phillhocking" workspaces { - name = "aws-ubuntu-tig-dev" + name = "aws-ubuntu-tig-prod" } } } diff --git a/main.tf b/main.tf index 103a808..b3f8cbb 100644 --- a/main.tf +++ b/main.tf @@ -9,7 +9,7 @@ data "aws_ami" "ubuntu" { filter { name = "name" - values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210621"] + values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20220131"] } filter { @@ -25,13 +25,13 @@ data "template_file" "deploy" { } -resource "aws_instance" "tig_dev" { +resource "aws_instance" "tig_prod" { ami = data.aws_ami.ubuntu.id instance_type = "t2.micro" key_name = var.key_name - vpc_security_group_ids = [aws_security_group.tig_dev.id] + vpc_security_group_ids = [aws_security_group.tig_prod.id] user_data = data.template_file.deploy.rendered tags = { - Name = "tig-dev" + Name = "tig-prod" } } diff --git a/outputs.tf b/outputs.tf index b7a7db0..22adf50 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,4 +1,4 @@ output "public_ip" { description = "List of public IP addresses assigned to the instances, if applicable" - value = aws_instance.tig_dev.public_ip + value = aws_instance.tig_prod.public_ip } diff --git a/security_groups.tf b/security_groups.tf index 2a70598..70b0cbb 100644 --- a/security_groups.tf +++ b/security_groups.tf @@ -1,5 +1,5 @@ -resource "aws_security_group" "tig_dev" { - name = "tig-dev" +resource "aws_security_group" "tig_prod" { + name = "tig-prod" description = "Allow SSH inbound, all HTTP inbound on port 3000, and all outbound traffic" ingress { @@ -9,9 +9,6 @@ resource "aws_security_group" "tig_dev" { cidr_blocks = [var.management_cidr_block] } - # These hardcoded values come from the Terraform Cloud API described at https://www.terraform.io/docs/cloud/api/ip-ranges.html so the provisioner blocks can run - # These may be subject to change - ingress { from_port = 3000 to_port = 3000 @@ -25,4 +22,4 @@ resource "aws_security_group" "tig_dev" { protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } -} \ No newline at end of file +} diff --git a/tig.sh b/tig.sh deleted file mode 100644 index 7c8dd2a..0000000 --- a/tig.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# This shell script is just for reference to ensure it works outside of the cloud-init process and so it can be formatted into the cloudinit.yml -sudo apt update ; sudo apt install -y build-essential net-tools curl git software-properties-common -wget https://dl.influxdata.com/telegraf/releases/telegraf_1.19.1-1_amd64.deb -sudo dpkg -i telegraf_1.19.1-1_amd64.deb -sudo systemctl enable --now telegraf -wget https://dl.influxdata.com/influxdb/releases/influxdb_1.8.6_amd64.deb -sudo dpkg -i influxdb_1.8.6_amd64.deb -sudo systemctl enable --now influxdb -influx -execute 'create database telegraf' -influx -execute "create user telegraf with password 'ExAmPl3PA55W0rD'" -influx -execute 'grant all on telegraf to telegraf' -sudo apt install -y adduser libfontconfig1 -wget https://dl.grafana.com/oss/release/grafana_8.0.5_amd64.deb -sudo dpkg -i grafana_8.0.5_amd64.deb -sudo systemctl daemon-reload ; sudo systemctl enable --now grafana-server -sudo mv /etc/telegraf/telegraf.conf{,.old} -sudo -i -telegraf config -input-filter cpu:mem:swap:system:processes:disk -output-filter influxdb > /etc/telegraf/telegraf.conf -sudo cat << EOF >> /etc/telegraf/telegraf.conf -# Configuration for sending metrics to InfluxDB -[[outputs.influxdb]] -urls = ["http://127.0.0.1:8086"] -database = "telegraf" -username = "telegraf" -password = "ExAmPl3PA55W0rD" -EOF -sudo systemctl restart telegraf \ No newline at end of file