Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set environment tag to staging #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion 01_05_base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ variable "ssh_key_name" {}
variable "private_key_path" {}

variable "region" {
default = "us-east-2"
default = "us-east-1"
}

variable "vpc_cidr" {
Expand Down Expand Up @@ -150,5 +150,6 @@ data "aws_ami" "aws-linux" {
# OUTPUT
# //////////////////////////////
output "instance-dns" {
// ec2-18-208-149-36.compute-1.amazonaws.com
value = aws_instance.nodejs1.public_dns
}
16 changes: 10 additions & 6 deletions 02_01_variables/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ variable "aws_access_key" {}
variable "aws_secret_key" {}

variable "region" {
default = "us-east-2"
default = "us-east-1"
}

variable "deploy_environment" {
default = "DEV"
}

variable "vpc_cidr" {
Expand Down Expand Up @@ -141,15 +145,15 @@ resource "aws_security_group" "sg-nodejs-instance" {
# INSTANCE
resource "aws_instance" "nodejs1" {
ami = data.aws_ami.aws-linux.id
instance_type = var.environment_instance_type["DEV"]
//instance_type = var.environment_instance_settings["PROD"].instance_type
//instance_type = var.environment_instance_type["DEV"]
instance_type = var.environment_instance_settings[var.deploy_environment].instance_type
subnet_id = aws_subnet.subnet1.id
vpc_security_group_ids = [aws_security_group.sg-nodejs-instance.id]

monitoring = var.environment_instance_settings["PROD"].monitoring

tags = {Environment = var.environment_list[0]}
monitoring = var.environment_instance_settings[var.deploy_environment].monitoring

# tags = {Environment = var.environment_list[0]}
tags = {Environment = var.environment_map[var.deploy_environment]}
}

# //////////////////////////////
Expand Down
4 changes: 4 additions & 0 deletions 02_02-07_variables/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,8 @@ data "aws_ami" "aws-linux" {
# //////////////////////////////
output "instance-dns" {
value = aws_instance.nodejs1.public_dns
}

output "private-dns" {
value = aws_instance.nodejs1.private_dns
}
2 changes: 1 addition & 1 deletion 02_08-09_expressions_functions/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "aws_access_key" {}
variable "aws_secret_key" {}

variable "region" {
default = "us-east-2"
default = "us-east-1"
}

variable "vpc_cidr" {
Expand Down
15 changes: 9 additions & 6 deletions 02_10_count/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ variable "iam_accounts" {
}

variable "region" {
default = "us-east-2"
default = "us-east-1"
}

variable "vpc_cidr" {
Expand Down Expand Up @@ -143,8 +143,8 @@ resource "aws_security_group" "sg-nodejs-instance" {
}

# INSTANCE
resource "aws_instance" "nodejs1" {
//count = 4
resource "aws_instance" "node_instances" {
count = 4

ami = data.aws_ami.aws-linux.id
instance_type = var.environment_instance_settings["PROD"].instance_type
Expand All @@ -156,7 +156,10 @@ resource "aws_instance" "nodejs1" {
tags = {Environment = var.environment_list[0]}
}


resource "aws_iam_user" "iam-users" {
for_each = var.iam_accounts
name = each.key
}
# //////////////////////////////
# DATA
# //////////////////////////////
Expand Down Expand Up @@ -186,5 +189,5 @@ data "aws_ami" "aws-linux" {
# OUTPUT
# //////////////////////////////
output "instance-dns" {
value = aws_instance.nodejs1.public_dns
}
value = aws_instance.node_instances.*.public_dns
}
4 changes: 2 additions & 2 deletions 02_11-12_modules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "aws_access_key" {}
variable "aws_secret_key" {}

variable "region" {
default = "us-east-2"
default = "us-east-1"
}


Expand Down Expand Up @@ -64,7 +64,7 @@ module "vpc" {
name = "frontend-vpc"
cidr = "10.0.0.0/16"

azs = ["us-east-2a", "us-east-2b", "us-east-2c"]
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

Expand Down
25 changes: 25 additions & 0 deletions 03_02-03_remotestate/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions 03_02-03_remotestate/commands.txt

This file was deleted.

24 changes: 24 additions & 0 deletions 03_02-03_remotestate/remote_resources/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 03_02-03_remotestate/remote_resources/s3_backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "aws_access_key" {}
variable "aws_secret_key" {}

variable "bucket_name" {
default = "red30-tfstate"
default = "red30-tfstate-dammngood"
}

# //////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion 03_05-06_multi_environment/manifests/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "aws_access_key" {}
variable "aws_secret_key" {}

variable "region" {
default = "us-east-2"
default = "us-east-1"
}

variable env_instance_type {}
Expand Down
2 changes: 1 addition & 1 deletion 03_05-06_multi_environment/manifests/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "vpc" {
name = "frontend-vpc"
cidr = "10.0.0.0/16"

azs = ["us-east-2a", "us-east-2b", "us-east-2c"]
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

Expand Down
2 changes: 1 addition & 1 deletion 03_07_custommodule/modules/nodejs-instance/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "ami_id" {
description = "The ID of the NodeJS AMI to deploy"
default = "ami-6685a403"
default = "ami-089a545a9ed9893b6"
}

variable instance_count {
Expand Down
2 changes: 1 addition & 1 deletion 04_04_terraform_cloud_cli/backend.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
terraform {
backend "remote" {
organization = "red30"
organization = "red30systems"

workspaces {
name = "cli-workspace"
Expand Down
2 changes: 1 addition & 1 deletion 04_05_terraform_cloud_vcs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "instance_count" {
variable "instance_tags" {
type = map
default = {
"environment" = "dev"
"environment" = "staging"
}
}
# //////////////////////////////
Expand Down