Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement S3 module #41

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions github-actions-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo: "Github secrets triggered by ${{ vars.CLOUD_VENDOR }}"
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
Expand Down
37 changes: 37 additions & 0 deletions iam_roles_and_policy.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
resource "aws_iam_role_policy" "test_policy" {
name = "test_policy"
role = aws_iam_role.test_role.id

# Terraform's "jsonencode" function converts a
# Terraform expression result to valid JSON syntax.
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"ec2:Describe*",
]
Effect = "Allow"
Resource = "*"
},
]
})
}

resource "aws_iam_role" "test_role" {
name = "test_role"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Sid = ""
Principal = {
Service = "ec2.amazonaws.com"
}
},
]
})
}
5 changes: 5 additions & 0 deletions new-resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "aws_s3_bucket" "AWS" {
bucket = "Bucket_name_AWS"
acl = "private"
}

21 changes: 21 additions & 0 deletions terraform/.terraform.lock.hcl

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

24 changes: 24 additions & 0 deletions terraform/ssh_key/.terraform.lock.hcl

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

4 changes: 4 additions & 0 deletions terraform/ssh_key/ssh_key.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "aws_key_pair" "deployer" {
key_name = "deployer-key"
public_key = file("~/.ssh/id_rsa.pub")
}
2 changes: 1 addition & 1 deletion terraform/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 4,
"terraform_version": "1.9.8",
"terraform_version": "1.10.0",
"serial": 1,
"lineage": "c49cef41-e140-8eee-bb81-5294bf9d8fc6",
"outputs": {},
Expand Down
5 changes: 5 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "Bucket_name_AWS" {
description = "The name of the S3 bucket"
type = string
}

Loading