Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/MKGF/Ranky into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
MKGF committed Jun 17, 2024
2 parents f19877b + afba9aa commit 8419241
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/aws-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
env:
BUCKET_NAME: ranky-s3

steps:

Expand Down Expand Up @@ -80,5 +80,13 @@ jobs:
BUCKET_NAME=ranky-s3
FILE_PATH=./terraform/terraform.tfstate
aws s3 cp $FILE_PATH s3://$BUCKET_NAME/terraform.tfstate
env:
BUCKET_NAME: ranky-s3
- name: Upload SSH Key .pem to S3 bucket
run: |
FILE_PATH=./terraform/ranky-ec2-ssh.pem
aws s3 cp $FILE_PATH s3://$BUCKET_NAME/ranky-ec2-ssh.pem
- name: Upload Ranky EC2 IP to S3 bucket
run: |
FILE_PATH=./terraform/ranky-ec2-ip.txt
aws s3 cp $FILE_PATH s3://$BUCKET_NAME/ranky-ec2-ip.txt
8 changes: 8 additions & 0 deletions terraform/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ resource "aws_instance" "ranky-ec2" {
]
}

resource "null_resource" "ranky-ec2-ip-to-file" {
depends_on = [aws_instance.ranky-ec2]

provisioner "local-exec" {
command = "echo ${aws_instance.ranky-ec2.public_ip} > ranky-ec2-ip.txt"
}
}

resource "aws_iam_instance_profile" "ranky-ec2-profile" {
name = "ranky-ec2-ecr-instance-profile"
role = aws_iam_role.ranky-ec2-role.name
Expand Down
2 changes: 1 addition & 1 deletion terraform/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "aws_key_pair" "ranky-ec2-keypair" {
}

resource "local_file" "private_key_file" {
filename = "ranky-ec2.pem"
filename = "ranky-ec2-ssh.pem"
content = tls_private_key.ranky-ec2-keypair.private_key_pem
}

Expand Down

0 comments on commit 8419241

Please sign in to comment.