Skip to content

Commit

Permalink
remove eventdriven rule creation & sort tf files (#74)
Browse files Browse the repository at this point in the history
distribute main.tf into multi tf
remove eventdriven rule creation module
update fireflyEventDrivenRulesPermission policy to specific actions
  • Loading branch information
radomarina authored Sep 5, 2024
1 parent 4ad2335 commit 427796d
Show file tree
Hide file tree
Showing 18 changed files with 894 additions and 1,463 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ module "firefly-read-only" {
role_external_id = "YOUR_EXTERNAL_ID"
is_prod = false/true
is_event_driven = true
terraform_create_rules = false
event_driven_regions = ["us-east-1","us-east-2","us-west-1","us-west-2","af-south-1","ap-east-1","ap-south-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","ca-central-1","cn-north-1","cn-northwest-1","eu-central-1","eu-west-1","eu-west-2","eu-west-3","eu-south-1","eu-north-1","me-south-1","sa-east-1","ap-south-2","ap-southeast-3","eu-south-2","me-central-1","il-central-1"]
use_config_service = true
config_service_regions = ["us-east-1","us-east-2","us-west-1","us-west-2","af-south-1","ap-east-1","ap-south-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","ca-central-1","cn-north-1","cn-northwest-1","eu-central-1","eu-west-1","eu-west-2","eu-west-3","eu-south-1","eu-north-1","me-south-1","sa-east-1","ap-south-2","ap-southeast-3","eu-south-2","me-central-1","il-central-1"]
}
```

Expand Down
7 changes: 7 additions & 0 deletions auth.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "firefly_auth" {
count = var.firefly_token == "" ? 1 : 0
source = "./modules/firefly_auth"
firefly_endpoint = var.firefly_endpoint
firefly_access_key = var.firefly_access_key
firefly_secret_key = var.firefly_secret_key
}
242 changes: 242 additions & 0 deletions iac.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
module "iac_events_ap_northeast_1" {
count = lookup(var.buckets_by_region, "ap-northeast-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-northeast-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-northeast-1")
region = "ap-northeast-1"
providers = {
aws = aws.ap_northeast_1
}
}

module "iac_events_ap_northeast_2" {
count = lookup(var.buckets_by_region, "ap-northeast-2", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-northeast-2", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-northeast-2")
region = "ap-northeast-2"
providers = {
aws = aws.ap_northeast_2
}
}


module "iac_events_ap_northeast_3" {
count = lookup(var.buckets_by_region, "ap-northeast-3", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-northeast-3", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-northeast-3")
region = "ap-northeast-3"
providers = {
aws = aws.ap_northeast_3
}
}

module "iac_events_ap_south_1" {
count = lookup(var.buckets_by_region, "ap-south-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-south-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-south-1")
region = "ap-south-1"
providers = {
aws = aws.ap_south_1
}
}

module "iac_events_ap_southeast_1" {
count = lookup(var.buckets_by_region, "ap-southeast-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-southeast-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-southeast-1")
region = "ap-southeast-1"
providers = {
aws = aws.ap_southeast_1
}
}

module "iac_events_ap_southeast_2" {
count = lookup(var.buckets_by_region, "ap-southeast-2", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-southeast-2", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-southeast-2")
region = "ap-southeast-2"
providers = {
aws = aws.ap_southeast_2
}
}

module "iac_events_ca_central_1" {
count = lookup(var.buckets_by_region, "ca-central-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ca-central-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ca-central-1")
region = "ca-central-1"
providers = {
aws = aws.ca_central_1
}
}

module "iac_events_eu_central_1" {
count = lookup(var.buckets_by_region, "eu-central-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "eu-central-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "eu-central-1")
region = "eu-central-1"
providers = {
aws = aws.eu_central_1
}
}

module "iac_events_eu_north_1" {
count = lookup(var.buckets_by_region, "eu-north-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "eu-north-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "eu-north-1")
region = "eu-north-1"
providers = {
aws = aws.eu_north_1
}
}

module "iac_events_eu_west_1" {
count = lookup(var.buckets_by_region, "eu-west-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "eu-west-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "eu-west-1")
region = "eu-west-1"
providers = {
aws = aws.eu_west_1
}
}

module "iac_events_eu_west_2" {
count = lookup(var.buckets_by_region, "eu-west-2", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "eu-west-2", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "eu-west-2")
region = "eu-west-2"
providers = {
aws = aws.eu_west_2
}
}

module "iac_events_eu_west_3" {
count = lookup(var.buckets_by_region, "eu-west-3", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "eu-west-3", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "eu-west-3")
region = "eu-west-3"
providers = {
aws = aws.eu_west_3
}
}

module "iac_events_sa_east_1" {
count = lookup(var.buckets_by_region, "sa-east-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "sa-east-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "sa-east-1")
region = "sa-east-1"
providers = {
aws = aws.sa_east_1
}
}

module "iac_events_us_east_1" {
count = lookup(var.buckets_by_region, "us-east-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "us-east-1", [])
sns_arn = var.iac_events_sns
region = "us-east-1"
providers = {
aws = aws.us_east_1
}
}

module "iac_events_us_east_2" {
count = lookup(var.buckets_by_region, "us-east-2", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "us-east-2", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "us-east-2")
region = "us-east-2"
providers = {
aws = aws.us_east_2
}
}

module "iac_events_us_west_1" {
count = lookup(var.buckets_by_region, "us-west-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "us-west-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "us-west-1")
region = "us-west-1"
providers = {
aws = aws.us_west_1
}
}

module "iac_events_us_west_2" {
count = lookup(var.buckets_by_region, "us-west-2", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "us-west-2", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "us-west-2")
region = "us-west-2"
providers = {
aws = aws.us_west_2
}
}

module "iac_events_ap_south_2" {
count = lookup(var.buckets_by_region, "ap-south-2", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-south-2", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-south-2")
region = "ap-south-2"
providers = {
aws = aws.ap_south_2
}
}

module "iac_events_ap_southeast_3" {
count = lookup(var.buckets_by_region, "ap-southeast-3", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "ap-southeast-3", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "ap-southeast-3")
region = "ap-southeast-3"
providers = {
aws = aws.ap_southeast_3
}
}

module "iac_events_eu_south_2" {
count = lookup(var.buckets_by_region, "eu-south-2", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "eu-south-2", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "eu-south-2")
region = "eu-south-2"
providers = {
aws = aws.eu_south_2
}
}

module "iac_events_me_central_1" {
count = lookup(var.buckets_by_region, "me-central-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "me-central-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "me-central-1")
region = "me-central-1"
providers = {
aws = aws.me_central_1
}
}

module "iac_events_il_central_1" {
count = lookup(var.buckets_by_region, "il-central-1", []) != [] ? 1 : 0
source = "./modules/s3_iac_events"
bucket_names = lookup(var.buckets_by_region, "il-central-1", [])
sns_arn = replace(var.iac_events_sns, "us-east-1", "il-central-1")
region = "il-central-1"
providers = {
aws = aws.il_central_1
}
}
4 changes: 4 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
locals {
firefly_role_name = "${var.resource_prefix}${var.firefly_role_name}"
firefly_deny_list_policy_name = "${var.resource_prefix}${var.firefly_deny_list_policy_name}"
}
Loading

0 comments on commit 427796d

Please sign in to comment.