Skip to content

Commit

Permalink
working on stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
arnol377 committed May 14, 2024
1 parent d4a121a commit 79f8b3b
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
data "aws_iam_policy_document" "s3_access" {
statement {
effect = "Allow"
actions = ["s3:*"]
resources = ["*"]
}
}


locals {
example_build_variables = [
{
name = "TF_VAR_greeting",
value = "Dave",
type = "PLAINTEXT"
}
]
}

locals {
vpc_id = "vpc-00576a396ec570b94"
}

resource "aws_codecommit_repository" "ansible" {
repository_name = "image-pipeline-ansible-roles"
description = "This is the Sample App Repository"
}

data "aws_region" "current" {}

resource "aws_vpc_endpoint" "codecommit" {
for_each = toset([
"codecommit",
"git-codecommit"
])
vpc_id = local.vpc_id
service_name = "com.amazonaws.${data.aws_region.current.name}.${each.value}"
vpc_endpoint_type = "Interface"
}

module "main" {
source = "HappyPathway/image-pipeline/aws"
project_name = "HelloAMI"
environment = "dev"
source_repo_name = "image-pipeline-hello-world"
source_repo_branch = "main"
create_new_repo = true
create_new_role = true
build_permissions_iam_doc = data.aws_iam_policy_document.s3_access
build_environment_variables = local.example_build_variables
ansible_repo = aws_codecommit_repository.ansible
vpc_config = {
vpc_id = local.vpc_id
security_group_ids = []
subnets = [
"subnet-062189d742937204e"
]
}
}


resource "aws_iam_service_specific_credential" "codecommit" {
service_name = "codecommit.amazonaws.com"
user_name = module.main.build_user.name
}

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)
}


output iam_arn {
value = module.main.iam_arn
}

0 comments on commit 79f8b3b

Please sign in to comment.