* Moving all vars to an input-vars.tf module

The idea with this is to centralize the variables so that they are
easier to find and configure. The old way was scattered and lead to
being unclear. There is also much more documentation added with this
patch for clarity-sake
This commit is contained in:
shockrah 2022-04-22 22:31:28 -07:00
parent 0977761976
commit 87f7daed2b
6 changed files with 80 additions and 20 deletions

View File

@ -1,12 +1,5 @@
# Alpha is our primary server that we use for bots which basically # Alpha is our primary server that we use for bots which basically
# serve services that I personally run # serve services that I personally run
variable "alpha_ssh_key_name" {}
variable "alpha_public_key_path" {}
variable "alpha_instance_type" {}
variable "alpha_ami_id" {}
resource "aws_key_pair" "alpha_ssh" { resource "aws_key_pair" "alpha_ssh" {
key_name = var.alpha_ssh_key_name key_name = var.alpha_ssh_key_name

View File

@ -1,10 +1,4 @@
# This module defines the beta server instance which # This module defines the beta server instance which
variable "beta_ssh_key_name" {}
variable "beta_public_key_path" {}
variable "beta_instance_type" {}
variable "beta_ami_id" {}
resource "aws_key_pair" "beta_ssh" { resource "aws_key_pair" "beta_ssh" {
key_name = var.beta_public_key_path key_name = var.beta_public_key_path

80
infra/input-vars.tf Normal file
View File

@ -0,0 +1,80 @@
# All variables that are used in various places go here
######################### General provider specific values
variable "aws_key" {
description = "Access Key for AWS operations"
type = string
sensitive = true
}
variable "aws_secret" {
description = "Secret Key for AWS operations"
type = string
sensitive = true
}
variable "aws_region" {
description = "Region where the VPC is located"
type = string
sensitive = true
}
######################### Alpha variables
variable "alpha_ssh_key_name" {
description = "Alpha ssh keyname"
type = string
sensitive = true
}
variable "alpha_public_key_path" {
description = "Alpha's path t key on local disk"
type = string
sensitive = true
}
variable "alpha_instance_type" {
description = "Alpha instance type(larger than beta due to docker requirement"
type = string
sensitive = true
}
variable "alpha_ami_id" {
description = "AMI type for the docker host"
type = string
}
######################### Beta variables
variable "beta_ssh_key_name" {
description = "SSH Key name for static web host"
type = string
sensitive = true
}
variable "beta_public_key_path" {
description = "Pub key path on disk"
type = string
sensitive = true
}
variable "beta_instance_type" {
description = "Host machine type"
type = string
}
variable "beta_ami_id" {
description = "AMI type for the static web host"
type = string
}
######################### Subnet variables
variable "crete_cidr" {
description = "CIDR block for the servers themselves"
type = string
}
variable "athens_availability_zone" {
description = "Availability zone for Project Bucket"
type = string
}
######################### VPC variables
variable "athens_cidr" {
description = "VPC Subnet CIDR block"
type = string
}

View File

@ -1,6 +1,3 @@
variable "aws_key" {}
variable "aws_secret" {}
variable "aws_region" {}
provider "aws" { provider "aws" {
access_key = var.aws_key access_key = var.aws_key

View File

@ -1,7 +1,4 @@
# This script represents the subnet structure for Crete(primary subnet) # This script represents the subnet structure for Crete(primary subnet)
variable "crete_cidr" {}
variable "athens_availability_zone" {}
# Crete will serve as the private subnet with internal services # Crete will serve as the private subnet with internal services
resource "aws_subnet" "crete_subnet" { resource "aws_subnet" "crete_subnet" {

View File

@ -1,4 +1,3 @@
variable "athens_cidr" {}
resource "aws_vpc" "athens_vpc" { resource "aws_vpc" "athens_vpc" {
cidr_block = var.athens_cidr cidr_block = var.athens_cidr