From b0358a21d2a711e55f9c124e3d1352aac24c11a6 Mon Sep 17 00:00:00 2001 From: Dave Arnold Date: Wed, 14 Aug 2024 12:29:52 -0700 Subject: [PATCH] chore: Update provider URLs in providers.tf and add image pipeline modules --- image-pipeline.tf | 75 ++++++++++++ main.tf | 297 ++++++++++++++++------------------------------ providers.tf | 4 +- 3 files changed, 177 insertions(+), 199 deletions(-) create mode 100644 image-pipeline.tf diff --git a/image-pipeline.tf b/image-pipeline.tf new file mode 100644 index 0000000..5349526 --- /dev/null +++ b/image-pipeline.tf @@ -0,0 +1,75 @@ +locals { + pipeline_repos = [ + "image-pipeline-goss-testing", + "image-pipeline-ansible-playbooks", + "linux-image-pipeline", + "windows-image-pipeline" + ] +} + +moved { + from = module.linux_image_pipeline + to = module.image_pipeline["linux-image-pipeline"] +} + +moved { + from = module.win_image_pipeline + to = module.image_pipeline["windows-image-pipeline"] +} + +moved { + from = module.goss-testing + to = module.image_pipeline["image-pipeline-goss-testing"] +} + +moved { + from = module.image_pipeline_ansible_playbooks + to = module.image_pipeline["image-pipeline-ansible-playbooks"] +} + +module "image_pipeline" { + for_each = toset(local.pipeline_repos) + 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 = each.value + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = true + collaborators = merge(local.collaborators, { garri325 = "admin" }) + admin_teams = [github_team.team.name] + pull_request_bypassers = local.pull_request_bypassers + extra_files = [ + { + path = ".github/workflows/s3_upload.yml" + content = templatefile( + "${path.module}/workflow.yaml.tpl", + { + repo_name = each.value + } + ) + } + ] +} + +# image-pipeline-asset-releases +module "asset_releases" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Terraform Workspace for publishing image-pipeline-assets" + repo_org = "arnol377" + name = "image-pipeline-asset-releases" + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] + pull_request_bypassers = local.pull_request_bypassers +} \ No newline at end of file diff --git a/main.tf b/main.tf index 8aa163c..f806ac6 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,5 @@ locals { - collaborators = { + collaborators = { naray007 = "push", morga471 = "push", lolli001 = "pull", @@ -12,41 +12,12 @@ locals { # Add a team to the organization resource "github_team" "team" { - name = "csvd-automation" + name = "csvd-automation" } -# resource "github_team_members" "members" { -# team_id = github_team.team.id -# dynamic members { -# for_each = tomap(local.collaborators) -# content { -# username = members.key -# role = "member" -# } -# } -# } - -# image-pipeline-asset-releases -module "asset_releases" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" - #github_codeowners_team = "CSVD" - github_repo_description = "Terraform Workspace for publishing image-pipeline-assets" - repo_org = "arnol377" - name = "image-pipeline-asset-releases" - github_repo_topics = [ - "terraform" - ] - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] - pull_request_bypassers = local.pull_request_bypassers -} - module "elastic_beanstalk" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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" @@ -54,72 +25,20 @@ module "elastic_beanstalk" { github_repo_topics = [ "terraform" ] - is_template = true - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } -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" - ] - force_name = true - create_codeowners = false - enforce_prs = true - collaborators = merge(local.collaborators, { garri325 = "admin" }) - admin_teams = [github_team.team.name] - pull_request_bypassers = local.pull_request_bypassers -} - - -module "linux_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 = "linux-image-pipeline" - github_repo_topics = [ - "terraform" - ] - force_name = true - create_codeowners = false - enforce_prs = true - collaborators = merge(local.collaborators, { garri325 = "admin" }) - admin_teams = [github_team.team.name] - pull_request_bypassers = local.pull_request_bypassers -} - - -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" - ] - force_name = true - create_codeowners = false - enforce_prs = true - collaborators = local.collaborators - admin_teams = [github_team.team.name] - pull_request_bypassers = local.pull_request_bypassers -} # terraform-repos module "automation-repos" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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" @@ -127,17 +46,17 @@ module "automation-repos" { github_repo_topics = [ "terraform" ] - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } # terraform-github-repo module "terraform-github-repo" { - source = "git@github.e.it.census.gov:CSVD/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" @@ -145,17 +64,17 @@ module "terraform-github-repo" { github_repo_topics = [ "terraform" ] - force_name = true - enforce_prs = false - create_codeowners = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + force_name = true + enforce_prs = false + create_codeowners = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } module "elastic_beanstalk_java" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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" @@ -163,19 +82,19 @@ module "elastic_beanstalk_java" { github_repo_topics = [ "terraform" ] - is_template = true - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - template_repo = "aws-beanstalk" - template_repo_org = "CSVD" - admin_teams = [github_team.team.name] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + template_repo = "aws-beanstalk" + template_repo_org = "CSVD" + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } module "elastic_beanstalk_php" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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" @@ -183,19 +102,19 @@ module "elastic_beanstalk_php" { github_repo_topics = [ "terraform" ] - is_template = true - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - template_repo = "aws-beanstalk" - template_repo_org = "CSVD" - admin_teams = [github_team.team.name] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + template_repo = "aws-beanstalk" + template_repo_org = "CSVD" + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } module "elastic_beanstalk_nodejs" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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" @@ -203,21 +122,21 @@ module "elastic_beanstalk_nodejs" { github_repo_topics = [ "terraform" ] - is_template = true - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - template_repo = "aws-beanstalk" - template_repo_org = "CSVD" - admin_teams = [github_team.team.name] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + template_repo = "aws-beanstalk" + template_repo_org = "CSVD" + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } module "elastic_beanstalk_docker" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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" @@ -225,21 +144,21 @@ module "elastic_beanstalk_docker" { github_repo_topics = [ "terraform" ] - is_template = true - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - template_repo = "aws-beanstalk" - template_repo_org = "CSVD" - admin_teams = [github_team.team.name] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + template_repo = "aws-beanstalk" + template_repo_org = "CSVD" + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } # image-pipeline module "image_pipeline" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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" @@ -247,52 +166,36 @@ module "image_pipeline" { github_repo_topics = [ "terraform" ] - force_name = true - create_codeowners = false - enforce_prs = true - collaborators = local.collaborators - admin_teams = [github_team.team.name] + force_name = true + create_codeowners = false + enforce_prs = true + collaborators = local.collaborators + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } module "beanstalk-demo" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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 Beanstalk Demo" + github_repo_description = "Terraform Workspace for creating and managing AWS Beanstalk Demo" repo_org = "arnol377" name = "beanstalk-flask-demo" github_repo_topics = [ "terraform" ] - force_name = true - create_codeowners = false - enforce_prs = false - is_template = true - collaborators = local.collaborators - admin_teams = [github_team.team.name] + force_name = true + create_codeowners = false + enforce_prs = false + is_template = true + collaborators = local.collaborators + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } -module "image_pipeline_ansible_playbooks" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" - #github_codeowners_team = "CSVD" - github_repo_description = "Repo for creating and managing Ansible Playbooks for use in Image Pipeline" - repo_org = "arnol377" - name = "image-pipeline-ansible-playbooks" - github_repo_topics = [ - "terraform" - ] - force_name = true - create_codeowners = false - enforce_prs = true - collaborators = local.collaborators - admin_teams = [github_team.team.name] - pull_request_bypassers = local.pull_request_bypassers -} module "image-pipeline-playbook" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for creating and managing Ansible Playbook" repo_org = "arnol377" @@ -300,29 +203,29 @@ module "image-pipeline-playbook" { github_repo_topics = [ "terraform" ] - force_name = true - create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } - + module "windows-ami-build" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + 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_is_private = true github_repo_topics = [ "terraform" ] - force_name = true - create_codeowners = false - enforce_prs = false - admin_teams = [github_team.team.name] + force_name = true + create_codeowners = false + enforce_prs = false + admin_teams = [github_team.team.name] pull_request_bypassers = local.pull_request_bypassers } @@ -335,11 +238,11 @@ module "arm_rhel_image_pipeline" { github_repo_topics = [ "terraform" ] - force_name = true + force_name = true create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] } module "setup_terraform" { @@ -350,12 +253,12 @@ module "setup_terraform" { github_repo_topics = [ "terraform" ] - force_name = true + force_name = true github_is_private = false create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] } module "setup_node" { @@ -366,12 +269,12 @@ module "setup_node" { github_repo_topics = [ "terraform" ] - force_name = true + force_name = true github_is_private = false create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] } # ghe-runner @@ -383,11 +286,11 @@ module "ghe_runners" { github_repo_topics = [ "terraform" ] - force_name = true + force_name = true github_is_private = false create_codeowners = false - enforce_prs = false - collaborators = local.collaborators - admin_teams = [github_team.team.name] + enforce_prs = false + collaborators = local.collaborators + admin_teams = [github_team.team.name] } diff --git a/providers.tf b/providers.tf index 9d1e34a..8200512 100644 --- a/providers.tf +++ b/providers.tf @@ -1,4 +1,4 @@ provider "github" { - owner = "CSVD" - base_url = "https://github.e.it.census.gov" + owner = "CSVD" + base_url = "https://github.e.it.census.gov" }