Skip to content

Commit

Permalink
Merge branch 'main' into testing_pr_check
Browse files Browse the repository at this point in the history
  • Loading branch information
arnol377 committed Aug 9, 2024
2 parents 26079e5 + 31f6313 commit 8ca9e75
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/terraform-apply.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CI
name: Terraform Apply

# Controls when the workflow will run
on:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/terraform-plan.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# This is a basic workflow to help you get started with Actions

name: CI
name: Terraform Plan


# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -21,18 +18,20 @@ jobs:
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SESSION_TOKEN: "${{ secrets.AWS_SESSION_TOKEN }}"


# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# - uses: CSVD/gh-actions-setup-node@v3
# with:
# node-version: 16

- uses: CSVD/gh-actions-setup-node@v3
with:
node-version: 16

# - uses: CSVD/gh-actions-setup-terraform@v2
# with:
# terraform_wrapper: false
- uses: CSVD/gh-actions-setup-terraform@v2
with:
terraform_wrapper: false

- name: Terraform fmt
id: fmt
Expand Down Expand Up @@ -88,3 +87,4 @@ jobs:
repo: context.repo.repo,
body: output
})
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc
ghe-runner
20 changes: 14 additions & 6 deletions linux.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
moved {
from = module.main
to = module.amazon_linux
}

module "amazon_linux" {
source = "HappyPathway/image-pipeline/aws"
Expand All @@ -18,7 +22,11 @@ module "amazon_linux" {
type = "PLAINTEXT"
}
]
packer_repo = data.aws_codecommit_repository.linux
packer_source_type = "S3"
packer_bucket = {
name = aws_s3_bucket.assets_bucket.bucket
key = "linux-image-pipeline.zip"
}
ansible_repo = data.aws_codecommit_repository.ansible
goss_repo = data.aws_codecommit_repository.goss
goss_profile = "base-test"
Expand All @@ -32,11 +40,11 @@ output "linux_iam_arn" {
value = module.amazon_linux.iam_arn
}

output "linux_codebuild_user" {
value = module.amazon_linux.build_user.name
}

output "linux_parameters" {
value = keys(module.amazon_linux.parameters)
sensitive = true
}
}

output linux_bucket {
value = module.amazon_linux.s3_bucket
}
17 changes: 14 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ resource "aws_s3_bucket" "state_bucket" {
bucket = "inf-test-${random_uuid.random.result}"
}

resource "aws_s3_bucket_server_side_encryption_configuration" "state_bucket_encryption" {
bucket = aws_s3_bucket.state_bucket.bucket
resource "aws_s3_bucket" "assets_bucket" {
bucket = "image-pipeline-assets"
}


resource "aws_s3_bucket_server_side_encryption_configuration" "state_bucket_encryption" {
for_each = tomap({
state_bucket = aws_s3_bucket.state_bucket.bucket
assets_bucket = aws_s3_bucket.assets_bucket.bucket
})
bucket = each.value
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "aws:kms"
Expand All @@ -18,7 +26,10 @@ data "aws_iam_policy_document" "s3_access" {
statement {
effect = "Allow"
actions = ["s3:*"]
resources = ["*"]
resources = [
aws_s3_bucket.state_bucket.arn,
aws_s3_bucket.assets_bucket.arn
]
}
}

Expand Down
13 changes: 0 additions & 13 deletions rhel.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,3 @@ module "rhel" {
source_ami = "ami-03fadeeea589a106b" # x86_64 compatible AMI
instance_type = "t3.micro" # x86_64 compatible instance type
}

output "rhel_iam_arn" {
value = module.amazon_linux.iam_arn
}

output "rhel_codebuild_user" {
value = module.amazon_linux.build_user.name
}

output "rhel_parameters" {
value = keys(module.amazon_linux.parameters)
sensitive = true
}
16 changes: 0 additions & 16 deletions windows.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,3 @@ module "windows" {
instance_type = "t2.xlarge" # x86_64 compatible instance type
}

output "winrm_password" {
value = nonsensitive(random_password.winrm.result)
}

output "windows_iam_arn" {
value = module.amazon_linux.iam_arn
}

output "windows_codebuild_user" {
value = module.amazon_linux.build_user.name
}

output "windows_parameters" {
value = keys(module.amazon_linux.parameters)
sensitive = true
}

0 comments on commit 8ca9e75

Please sign in to comment.