-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
38,783 additions
and
71 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
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,25 +1,65 @@ | ||
| module "external_dependencies" { | ||
| source = "../terraform-aws-image-pipeline-external" | ||
|
|
||
| project_name = "aws-image-pipeline" | ||
| assets_bucket_name = aws_s3_bucket.assets_bucket.bucket | ||
| region = local.vpc_config.region | ||
| vpc_id = local.vpc_config.vpc_id | ||
| subnet_ids = local.vpc_config.subnets | ||
| project_name = "aws-image-pipeline" | ||
| assets_bucket_name = "image-pipeline-assets" | ||
| state_bucket_name = local.state_config.bucket | ||
|
|
||
| pipeline_iam_arns = [ | ||
| module.amazon_linux.iam_arn, | ||
| module.morpheus.iam_arn | ||
| ] | ||
|
|
||
| pipeline_iam_arns = [] # Initially empty, will be updated by aws_s3_bucket_policy | ||
|
|
||
| vpc_config = { | ||
| vpc_id = local._vpc_config.vpc_id | ||
| region = local._vpc_config.region | ||
| security_group_ids = local._vpc_config.security_group_ids | ||
| subnets = local._vpc_config.subnets | ||
| subnets = local._vpc_config.subnets | ||
| } | ||
|
|
||
| # Add common tags | ||
| # Feature flags | ||
| enable_assets_bucket = true | ||
| enable_vpc_endpoints = true | ||
| enable_security_groups = true | ||
| enable_state_backend = true | ||
| enable_build_user = true | ||
|
|
||
| tags = { | ||
| Project = "aws-image-pipeline" | ||
| Environment = local.environment | ||
| Environment = "dev" | ||
| } | ||
| } | ||
|
|
||
| # Create bucket policy separately after roles are created | ||
| resource "aws_s3_bucket_policy" "assets_bucket_policy" { | ||
| bucket = module.external_dependencies.assets_bucket_name | ||
| policy = jsonencode({ | ||
| Version = "2012-10-17" | ||
| Statement = [ | ||
| { | ||
| Sid = "AllowPipelineAccess" | ||
| Effect = "Allow" | ||
| Principal = { | ||
| AWS = [ | ||
| module.amazon_linux.iam_arn, | ||
| module.morpheus.iam_arn | ||
| ] | ||
| } | ||
| Action = [ | ||
| "s3:Get*", | ||
| "s3:List*", | ||
| "s3:PutObject", | ||
| "s3:DeleteObject" | ||
| ] | ||
| Resource = [ | ||
| module.external_dependencies.assets_bucket_arn, | ||
| "${module.external_dependencies.assets_bucket_arn}/*" | ||
| ] | ||
| } | ||
| ] | ||
| }) | ||
|
|
||
| depends_on = [ | ||
| module.amazon_linux, | ||
| module.morpheus, | ||
| module.external_dependencies | ||
| ] | ||
| } |
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,11 +1,7 @@ | ||
| # module.morpheus.module.build_user[0].aws_secretsmanager_secret.credentials | ||
| import { | ||
| to = module.morpheus.module.build_user[0].aws_secretsmanager_secret.credentials | ||
| id = "arn:aws-us-gov:secretsmanager:us-gov-west-1:229685449397:secret:/image-pipeline/morpheus-app/build_user_credentials-BF4y0w" | ||
| } | ||
| # Now handled by the external module | ||
| # import { | ||
| # to = module.morpheus.module.build_user[0].aws_secretsmanager_secret.credentials | ||
| # id = "arn:aws-us-gov:secretsmanager:us-gov-west-1:229685449397:secret:/image-pipeline/morpheus-app/build_user_credentials-BF4y0w" | ||
| # } | ||
|
|
||
| # module.morpheus.aws_secretsmanager_secret.ssh_key | ||
| import { | ||
| to = module.morpheus.aws_secretsmanager_secret.ssh_key | ||
| id = "arn:aws-us-gov:secretsmanager:us-gov-west-1:229685449397:secret:/image-pipeline/morpheus-app/ssh-private-key-FCQtUR" | ||
| } | ||
| # module.morpheus.aws_secretsmanager_secret.ssh_key |
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
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,23 +1,19 @@ | ||
| resource "random_uuid" "random" {} | ||
|
|
||
| data "aws_iam_policy_document" "build_user_policy_document" { | ||
| statement { | ||
| actions = [ | ||
| "s3:Get*", | ||
| "s3:List*", | ||
| "s3:ReplicateObject", | ||
| "s3:PutObject", | ||
| "s3:RestoreObject", | ||
| "s3:PutObjectVersionTagging", | ||
| "s3:PutObjectTagging", | ||
| "s3:PutObjectAcl" | ||
| ] | ||
|
|
||
| resources = [ | ||
| module.external_dependencies.assets_bucket_arn, | ||
| "${module.external_dependencies.assets_bucket_arn}/*", | ||
| ] | ||
| terraform { | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = "~> 5.0" | ||
| } | ||
| random = { | ||
| source = "hashicorp/random" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "aws" { | ||
| region = "us-gov-west-1" # Using hardcoded value from locals.tf | ||
| } | ||
|
|
||
| resource "random_uuid" "random" {} | ||
|
|
||
|
|
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
Oops, something went wrong.