Some bugfixes
This commit is contained in:
parent
301faefdcb
commit
71619fb249
|
@ -8,6 +8,11 @@ variable "aws_region" {
|
|||
default = "${env("AWS_REGION")}"
|
||||
}
|
||||
|
||||
variable "fathom_site_id" {
|
||||
type = string
|
||||
default = "${env("FATHOM_SITE_ID")}"
|
||||
}
|
||||
|
||||
variable "s3_bucket" {
|
||||
type = string
|
||||
default = "${env("S3_BUCKET")}"
|
||||
|
@ -81,6 +86,7 @@ build {
|
|||
environment_vars = [
|
||||
"ADMIN_PASSWORD=${var.admin_password}",
|
||||
"AWS_REGION=${var.aws_region}",
|
||||
"FATHOM_SITE_ID=${var.fathom_site_id}",
|
||||
"S3_BUCKET=${var.s3_bucket}",
|
||||
"SUPERVISOR_ACCESS_TOKEN=${var.supervisor_access_token}",
|
||||
]
|
||||
|
|
10
tf/asg.tf
10
tf/asg.tf
|
@ -78,12 +78,10 @@ resource "aws_launch_template" "server" {
|
|||
resource "aws_autoscaling_group" "server" {
|
||||
name = "riju-server"
|
||||
|
||||
availability_zones = [
|
||||
for subnet in data.aws_subnet.default : subnet.availability_zone
|
||||
]
|
||||
desired_capacity = 1
|
||||
min_size = 1
|
||||
max_size = 3
|
||||
availability_zones = [local.primary_az]
|
||||
desired_capacity = 1
|
||||
min_size = 1
|
||||
max_size = 3
|
||||
|
||||
launch_template {
|
||||
id = aws_launch_template.server.id
|
||||
|
|
|
@ -60,7 +60,7 @@ resource "aws_cloudwatch_metric_alarm" "server_data_volume_disk_space" {
|
|||
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
||||
dimensions = {
|
||||
AutoScalingGroupName = aws_autoscaling_group.server.name
|
||||
path = "/mnt/riju/data"
|
||||
path = "/mnt/riju"
|
||||
}
|
||||
|
||||
tags = {
|
||||
|
|
|
@ -55,3 +55,7 @@ data "aws_subnet" "default" {
|
|||
for_each = data.aws_subnet_ids.default.ids
|
||||
id = each.value
|
||||
}
|
||||
|
||||
locals {
|
||||
primary_az = sort([for subnet in data.aws_subnet.default : subnet.availability_zone])[0]
|
||||
}
|
||||
|
|
13
tf/ssm.tf
13
tf/ssm.tf
|
@ -1,3 +1,10 @@
|
|||
resource "aws_ssm_parameter" "web_ami_id" {
|
||||
name = "riju-web-ami-id"
|
||||
type = "String"
|
||||
value = data.aws_ami.server.id
|
||||
data_type = "aws:ec2:image"
|
||||
}
|
||||
|
||||
resource "aws_ssm_parameter" "ci_ami_id" {
|
||||
name = "riju-ci-ami-id"
|
||||
type = "String"
|
||||
|
@ -22,3 +29,9 @@ resource "aws_ssm_parameter" "s3_bucket" {
|
|||
type = "String"
|
||||
value = aws_s3_bucket.riju.bucket
|
||||
}
|
||||
|
||||
resource "aws_ssm_parameter" "asg_desired_capacity" {
|
||||
name = "riju-asg-desired-capacity"
|
||||
type = "String"
|
||||
value = aws_autoscaling_group.server.desired_capacity
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue