-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New AWS Multi Account ready setup with a better approach (#22)
* Delete unused files and update infrastructure diagram to match the new multi-account setup * terraform-docs: automated action * Update backend.tf for prod and staging environments * Update AWS region to us-west-2 * Remove 'stage' variable from module 'label' * Update label_order in context.tf * Update VPC CIDR block * Update module source paths * terraform-docs: automated action * Remove unused Terraform files and modules * Update working directory in tf-docs.yml * Rebuild --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
26ee7ea
commit adbbd38
Showing
29 changed files
with
626 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ jobs: | |
- name: Render terraform docs inside modules | ||
uses: terraform-docs/[email protected] | ||
with: | ||
working-dir: modules/amplify-app,modules/rds,modules/vpc,modules/bastion,live/core | ||
working-dir: modules/amplify-app,modules/rds,modules/vpc,modules/bastion,live/prod/us-west-2/app,live/staging/us-west-2/app | ||
output-file: docs/MODULE.md | ||
output-method: replace | ||
git-push: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
live/core/bastion.tf → live/prod/us-west-2/app/bastion.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
variable "enable_bastion" { | ||
type = bool | ||
description = "Enable bastion host" | ||
default = false | ||
locals { | ||
bastion = { | ||
enable = true | ||
} | ||
} | ||
|
||
module "bastion" { | ||
count = var.enable_bastion ? 1 : 0 | ||
count = local.bastion.enable ? 1 : 0 | ||
|
||
source = "../../modules/bastion" | ||
source = "../../../../modules/bastion" | ||
name = "${module.label.id}-bastion" | ||
vpc_id = module.vpc.vpc_id | ||
subnets = module.vpc.public_subnets | ||
associate_public_ip_address = true | ||
associate_elastic_ip_address = false | ||
associate_elastic_ip_address = true | ||
tags = module.label.tags | ||
} | ||
|
||
output "bastion_instance_id" { | ||
value = var.enable_bastion ? module.bastion[0].instance_id : null | ||
value = local.bastion.enable ? module.bastion[0].instance_id : null | ||
} | ||
|
||
output "bastion_instance_profile" { | ||
value = var.enable_bastion ? module.bastion[0].instance_profile : null | ||
value = local.bastion.enable ? module.bastion[0].instance_profile : null | ||
} | ||
|
||
output "ssm_parameter_bastion_ssh_key" { | ||
description = "name of the ssm parameter for the bastion ssh key" | ||
value = var.enable_bastion ? module.bastion[0].ssm_parameter_ssh_key : null | ||
value = local.bastion.enable ? module.bastion[0].ssm_parameter_ssh_key : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
locals { | ||
context = { | ||
name = "app" | ||
namespace = "nan" | ||
environment = "prod" | ||
tags = { | ||
"Terraform" = "true" | ||
"Environment" = "prod" | ||
} | ||
} | ||
} | ||
|
||
data "aws_caller_identity" "aws" {} | ||
|
||
locals { | ||
tf_tags = { | ||
Terraform = true, | ||
By = data.aws_caller_identity.aws.arn | ||
} | ||
} | ||
|
||
// Keep labels, tags consistent | ||
module "label" { | ||
source = "cloudposse/label/null" | ||
version = "0.25.0" | ||
|
||
name = local.context.name | ||
environment = local.context.environment | ||
namespace = local.context.namespace | ||
|
||
delimiter = "-" | ||
label_order = ["namespace", "environment", "name", "attributes"] | ||
tags = merge(local.context.tags, local.tf_tags) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 8 additions & 13 deletions
21
live/core/example-rds-instance.tf → ...rod/us-west-2/app/example-rds-instance.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
provider "aws" { | ||
region = var.region | ||
region = "us-west-2" | ||
|
||
default_tags { | ||
tags = { | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.