From 6402830f850e6319d304319eaff41a31e54e457b Mon Sep 17 00:00:00 2001 From: Dave Arnold Date: Wed, 3 Jul 2024 13:27:03 -0400 Subject: [PATCH] migrating to internal module --- .terraform.lock.hcl | 52 +++++-------- main.tf | 179 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 160 insertions(+), 71 deletions(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index c7aef29..b2ea639 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -2,46 +2,32 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "5.53.0" + version = "5.56.1" constraints = ">= 2.0.0" hashes = [ - "h1:yIDopRNeRAXg1UZpPlO6GNofDyzqSPkl/+Eoc3pKW4Q=", - "zh:2adad39412111d19a5195474d6b95577fc25ccf06d88a90019bee0efba33a1e3", - "zh:51226453a14f95b0d1163cfecafc9cf1a92ce5f66e42e6b4065d83a813836a2c", - "zh:62450fadb56db9c18d50bb8b7728a3d009be608d7ee0d4fe95c85ccb521dff83", - "zh:6f3ad977a9cc4800847c136690b1c0a0fd8437705062163d29dc4e9429598950", - "zh:71ca0a16b735b8d34b7127dd7d1e1e5d1eaac9c9f792e08abde291b5beb947d5", - "zh:7ae9cf4838eea80288305be0a3e69b39ffff86ede7b4319be421f06d32d04fb6", - "zh:93abc2db5ad995cfee014eb7446abc7caedc427e141d375a11993e6e199076b5", - "zh:9560b3424d97da804e98ee86b474b7370afefa09baf350cae7f33afb3f1aa209", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9eb57a9b649c217ac4eeb27af2a1935c18bd9bc8fb1be07434e7de74729eff46", - "zh:b5f32dcbe71ea22c2090eeeaec9af3e098d7b8c3e4491f34ffdfdc6f1c1abf81", - "zh:c9fbd5417f266c773055178e87bb4091df7f0542b72bf5ad0a4ae27045a2b7ca", - "zh:d518b3c52c8a9f79769dbe1b3683d25b4cdc8bfc77a3b3cd9c85f74e6c7383e1", - "zh:db741be21f32404bb87d73d25b1b7fd9b813b00aeb20a130ed8806d44dc26680", - "zh:ed1a8bb4d08653d87265ae534d6fc33bbdabae1608692a1ee364fce03548d36c", + "h1:3c0jJCaLRgXrOZoGMAOjH+omtHUo96AkukUF4/h9gaE=", ] } provider "registry.terraform.io/hashicorp/github" { - version = "6.2.1" + version = "6.2.2" hashes = [ - "h1:ip7024qn1ewDqlNucxh07DHvuhSLZSqtTGewxNLeYYU=", - "zh:172aa5141c525174f38504a0d2e69d0d16c0a0b941191b7170fe6ae4d7282e30", - "zh:1a098b731fa658c808b591d030cc17cc7dfca1bf001c3c32e596f8c1bf980e9f", - "zh:245d6a1c7e632d8ae4bdd2da2516610c50051e81505cf420a140aa5fa076ea90", - "zh:43c61c230fb4ed26ff1b04b857778e65be3d8f80292759abbe2a9eb3c95f6d97", - "zh:59bb7dd509004921e4322a196be476a2f70471b462802f09d03d6ce96f959860", - "zh:5cb2ab8035d015c0732107c109210243650b6eb115e872091b0f7b98c2763777", - "zh:69d2a6acfcd686f7e859673d1c8a07fc1fc1598a881493f19d0401eb74c0f325", - "zh:77f36d3f46911ace5c50dee892076fddfd64a289999a5099f8d524c0143456d1", - "zh:87df41097dfcde72a1fbe89caca882af257a4763c2e1af669c74dcb8530f9932", - "zh:899dbe621f32d58cb7c6674073a6db8328a9db66eecfb0cc3fc13299fd4e62e7", - "zh:ad2eb7987f02f7dd002076f65a685730705d04435313b5cf44d3a6923629fb29", - "zh:b2145ae7134dba893c7f74ad7dfdc65fdddf6c7b1d0ce7e2f3baa96212322fd8", - "zh:bd6bae3ac5c3f96ad9219d3404aa006ef1480e9041d4c95df1808737e37d911b", - "zh:e89758b20ae59f1b9a6d32c107b17846ddca9634b868cf8f5c927cbb894b1b1f", + "h1:3gbrNGsK0dQ5zpN0qeHm3uNdWJl+f760+VtV2GJZ8Vg=", + "zh:43d7e5f1e11d67e38ca717016d209d6d9a6fa03321b489f91984351bfb143b69", + "zh:46e788395034b410bf59dfa43eb748a3d81ecfd23fc442349990fd7d92bd856a", + "zh:5234b7d5c5817ff7ebec29756050708372a071a701e2c8236e714a0bd29ef160", + "zh:74c485a241cc8e8cb99f988d38116fb14e51de896761fc9ca35a34ca5c999a7e", + "zh:7606789521c50937913ea13f851150828b5f9b8804ba80c5b2538c0b019339d8", + "zh:760fb0e74590459689c7159456b6e76f165634f7d0f89f5572d56b57d387f645", + "zh:7979d9085d809bb7d0db2c67e6c3443d1c18d12e51b72220dcb4cc5e883cd64a", + "zh:8bed25d8199bf8b2e7ccf67edc1a4a2fc041bd490b2c11565c669b80be43896c", + "zh:9ff82a6279fb7ae0cd9e44f1e73b64dd2aeca43d4d3096f3f2866b1ebbcb9431", + "zh:a886055ecd63ccb9b880e3c3301c0eca9acb108580d12519617554ae2be9a393", + "zh:c1f20386704919c7964a95daffcb29f494efb061abc28469840df4532833cecf", + "zh:cb6e9c4e33d6a57770073867e174c09c0eed401ee70473a688d20cb1cf0394f7", + "zh:f89ca130cc90b87dc25d036fe8f8cadb6fb53dc33368a032c5cee6275f3bcddc", + "zh:f94a2d1174091f04ed361192cdda9503baa3d161849d4f218c55a96bfb1ea33d", + "zh:fbd1fee2c9df3aa19cf8851ce134dea6e45ea01cb85695c1726670c285797e25", ] } diff --git a/main.tf b/main.tf index f87f0e1..65d6091 100644 --- a/main.tf +++ b/main.tf @@ -3,12 +3,12 @@ locals { naray007 = "write", morga471 = "write", lolli001 = "write", - # gomez385 = "write" + gomez385 = "write" } } module "elastic_beanstalk" { - source = "HappyPathway/repo/github" + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating Elastic Beanstalk Apps and Environments" repo_org = "arnol377" @@ -23,30 +23,78 @@ module "elastic_beanstalk" { collaborators = local.collaborators } -#module "goss-testing" { -# source = "HappyPathway/repo/github" -# #github_codeowners_team = "CSVD" -# github_repo_description = "Goss testing suite for ec2 instances" -# repo_org = "CSVD" -# name = "image-pipeline-goss-testing" -# github_repo_topics = [ -# "terraform" -# ] -# is_template = true -# force_name = true -# create_codeowners = false -# enforce_prs = false -# collaborators = { -# naray007 = "write", -# morga471 = "write", -# # gomez385 = "write" -# } -#} +module "win_image_pipeline" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Template repo for windows image pipelines" + repo_org = "arnol377" + name = "windows-image-pipeline" + github_repo_topics = [ + "terraform" + ] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = merge(local.collaborators, { garri325 = "write" }) +} + +module "goss-testing" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Goss testing suite for ec2 instances" + repo_org = "CSVD" + name = "image-pipeline-goss-testing" + github_repo_topics = [ + "terraform" + ] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = { + naray007 = "write", + morga471 = "write", + # gomez385 = "write" + } +} + +# terraform-repos +module "automation-repos" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Automation Repos for Morpheus POC" + repo_org = "CSVD" + name = "automation-repos" + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators +} + +# terraform-github-repo +module "terraform-github-repo" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Terraform Module for managing github repos" + repo_org = "CSVD" + name = "terraform-github-repo" + github_repo_topics = [ + "terraform" + ] + force_name = true + enforce_prs = false + create_codeowners = false + collaborators = local.collaborators +} module "elastic_beanstalk_java" { - source = "HappyPathway/repo/github" + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating Elastic Beanstalk Apps and Environments" repo_org = "arnol377" @@ -64,7 +112,7 @@ module "elastic_beanstalk_java" { } module "elastic_beanstalk_nodejs" { - source = "HappyPathway/repo/github" + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating Elastic Beanstalk Apps and Environments" repo_org = "arnol377" @@ -84,7 +132,7 @@ module "elastic_beanstalk_nodejs" { module "elastic_beanstalk_docker" { - source = "HappyPathway/repo/github" + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating Elastic Beanstalk Apps and Environments" repo_org = "arnol377" @@ -104,7 +152,7 @@ module "elastic_beanstalk_docker" { # image-pipeline module "image_pipeline" { - source = "HappyPathway/repo/github" + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating and managing AWS Image Pipelines" repo_org = "arnol377" @@ -119,12 +167,12 @@ module "image_pipeline" { } -module "dev_network" { - source = "HappyPathway/repo/github" +module "beanstalk-demo" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating and managing AWS Dev Network" repo_org = "arnol377" - name = "aws-dev-network" + name = "beanstalk-flask-demo" github_repo_topics = [ "terraform" ] @@ -134,14 +182,16 @@ module "dev_network" { admin_teams = [ "csvd_users" ] + is_template = true + collaborators = local.collaborators } -module "beanstalk-demo" { - source = "HappyPathway/repo/github" +module "image-pipeline-ansible-roles" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating and managing AWS Dev Network" repo_org = "arnol377" - name = "beanstalk-flask-demo" + name = "image-pipeline-ansible-roles" github_repo_topics = [ "terraform" ] @@ -152,16 +202,43 @@ module "beanstalk-demo" { "csvd_users" ] is_template = true - collaborators = { - naray007 = "write", - morga471 = "write", - lolli001 = "write" - } - + collaborators = local.collaborators } +module "image-pipeline-playbook" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Terraform Workspace for creating and managing AWS Dev Network" + repo_org = "arnol377" + name = "image-pipeline-playbook" + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false + admin_teams = [ + "csvd_users" + ] + is_template = true + collaborators = local.collaborators +} + - +module "windows-ami-build" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Terraform Workspace for creating and managing AWS Dev Network" + repo_org = "arnol377" + name = "windows-ami-build" + github_is_private = true + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false +} resource "aws_codecommit_repository" "ansible" { repository_name = "image-pipeline-ansible-roles" @@ -174,3 +251,29 @@ resource "aws_codecommit_repository" "goss-testing" { description = "Goss testing suite for ec2 images" } + +data terraform_remote_state pipeline { + backend = "s3" + config = { + bucket = "inf-tfstate-229685449397" + key = "csvd-dev-gov/common/apps/aws-image-pipeline-demo" + region = "us-gov-east-1" + dynamodb_table = "tf_remote_state" + } +} + +resource "aws_iam_service_specific_credential" "codecommit" { + service_name = "codecommit.amazonaws.com" + user_name = data.terraform_remote_state.pipeline.outputs.codebuild_user +} + + +output codecommit_credentials_username { + value = aws_iam_service_specific_credential.codecommit.service_user_name +} + +output codecommit_credentials_password { + value =nonsensitive(aws_iam_service_specific_credential.codecommit.service_password) +} + +