Skip to content
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
9 changes: 8 additions & 1 deletion .github/workflows/aws_tf_appy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ jobs:
run: exit 1

- name: Terraform Apply
run: terraform apply -auto-approve
run: terraform apply -auto-approve

- name: Capture Output in .txt file
run: terraform output > ${{ github.workspace }}/output.txt

- name: Display Out put file
run: |
cat ${{ github.workspace }}/output.txt
8 changes: 4 additions & 4 deletions AWS-Multi-Region-Deployment/SNS/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
resource "aws_sns_topic" "example" {
count = length(var.aws_regions)
name = "${var.aws_sns_topic_name}-${var.aws_regions[count.index]}"
name = "${var.aws_sns_topic_name}-${var.aws_region}"
display_name = "Multi Region SNS Topic"
provider = aws.regions[var.aws_regions[count.index]]
}

output "sns_topic_arns" {
value = aws_sns_topic.example.*.arn
}
}
*/
9 changes: 4 additions & 5 deletions AWS-Multi-Region-Deployment/SNS/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
variable "aws_regions" {
type = list(string)
default = ["us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1"]
}

variable "aws_sns_topic_name" {
type = string
default = "cloud_quick_labs_sns"
}

variable "aws_region" {
type = string
}
38 changes: 34 additions & 4 deletions AWS-Multi-Region-Deployment/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
provider "aws" {
region = var.aws_region
module "us-east-1" {
source = "./SNS"

aws_region = "us-east-1"
aws_sns_topic_name = var.aws_sns_topic_name
}

module "us-east-2" {
source = "./SNS"

aws_region = "us-east-2"
aws_sns_topic_name = var.aws_sns_topic_name
providers = {
aws = aws.us-east-2
}
}

module "sns_topics" {
source = "AWS-Multi-Region-Deployment/SNS"

module "us-west-1" {
source = "./SNS"

aws_region = "us-west-1"
aws_sns_topic_name = var.aws_sns_topic_name
providers = {
aws = aws.us-west-1
}
}

module "us-west-2" {
source = "./SNS"

aws_region = "us-west-2"
aws_sns_topic_name = var.aws_sns_topic_name
providers = {
aws = aws.us-west-2
}
}
18 changes: 18 additions & 0 deletions AWS-Multi-Region-Deployment/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
provider "aws" {
region = "us-east-1"
}

provider "aws" {
alias = "us-east-2"
region = "us-east-2"
}

provider "aws" {
alias = "us-west-1"
region = "us-west-1"
}

provider "aws" {
alias = "us-west-2"
region = "us-west-2"
}
7 changes: 1 addition & 6 deletions AWS-Multi-Region-Deployment/variables.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
variable "aws_regions" {
type = list(string)
default = ["us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1"]
}

variable "aws_sns_topic_name" {
type = string
default = "cloud_quick_labs_sns"
}
}