mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
Merge pull request #1 from teddy931130/devops_task
Initial Terraform infra + build workflow
This commit is contained in:
commit
c0b9aefb72
21 changed files with 525 additions and 4 deletions
97
.github/workflows/build.yml
vendored
Normal file
97
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
name: Build and Push go-ethereum Docker image to ECR
|
||||||
|
|
||||||
|
on:
|
||||||
|
# keep for manual trigger if needed
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
create_tag:
|
||||||
|
description: "Create and push a new tag?"
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
|
|
||||||
|
env:
|
||||||
|
AWS_ACCOUNT_ID: "861276097334"
|
||||||
|
AWS_REGION: "eu-central-1"
|
||||||
|
ECR_REPO_NAME: "limechain-devops-task/go-ethereum"
|
||||||
|
IAM_OIDC_ROLE_NAME: "go-ethereum-github-actions-role"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Build')
|
||||||
|
runs-on: ubuntu:22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
- name: Configure AWS Credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
|
with:
|
||||||
|
aws-region: ${{ env.AWS_REGION }}
|
||||||
|
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.IAM_OIDC_ROLE_NAME }}
|
||||||
|
role-session-name: go-ethereum-github-actions
|
||||||
|
|
||||||
|
- name: Login to Amazon ECR
|
||||||
|
id: login-ecr
|
||||||
|
run: |
|
||||||
|
FULL_ECR_URL=${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com
|
||||||
|
aws ecr get-login-password --region ${{ env.AWS_REGION }} | docker login --username AWS --password-stdin ${FULL_ECR_URL}
|
||||||
|
|
||||||
|
- name: Get latest image tag
|
||||||
|
id: get-latest-tag
|
||||||
|
run: |
|
||||||
|
LATEST_TAG=$(aws ecr describe-images \
|
||||||
|
--repository-name ${{ env.ECR_REPO_NAME }} \
|
||||||
|
--region ${{ env.AWS_REGION }} \
|
||||||
|
--query 'sort_by(imageDetails,&imagePushedAt)[-1].imageTags[0]' \
|
||||||
|
--output text)
|
||||||
|
if [[ "$LATEST_TAG" == "None" ]]; then
|
||||||
|
NEW_TAG=1
|
||||||
|
else
|
||||||
|
NEW_TAG=$((LATEST_TAG + 1))
|
||||||
|
fi
|
||||||
|
echo "new-tag=${NEW_TAG}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# - name: Build and push Docker Image
|
||||||
|
# run: |
|
||||||
|
# FULL_ECR_URL="${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO_NAME }}"
|
||||||
|
# NEW_TAG="${{ steps.get-latest-tag.outputs.new-tag }}"
|
||||||
|
|
||||||
|
# docker build \
|
||||||
|
# --build-arg VAR="VALUE" \
|
||||||
|
# -t "${FULL_ECR_URL}:${NEW_TAG}" \
|
||||||
|
# -f Dockerfile .
|
||||||
|
|
||||||
|
# docker push "${FULL_ECR_URL}:${NEW_TAG}"
|
||||||
|
|
||||||
|
- name: Notify PR of New Tag
|
||||||
|
if: ${{ inputs.create_tag }} == 'true'
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
NEW_TAG=v${{ steps.get-latest-tag.outputs.new-tag }}
|
||||||
|
git tag -a $NEW_TAG -m "New tag: $NEW_TAG"
|
||||||
|
git push origin $NEW_TAG
|
||||||
|
|
||||||
|
PR_NUMBER=$(gh pr list --head ${{ github.ref_name }} --state open --json number --jq '.[0].number')
|
||||||
|
if [[ -n "$PR_NUMBER" ]]; then
|
||||||
|
echo ":rocket: A new tag ${NEW_TAG} has been created and pushed!"
|
||||||
|
gh pr comment $PR_NUMBER -b ":rocket: A new tag ${NEW_TAG} has been created and pushed!"
|
||||||
|
else
|
||||||
|
echo ":rocket: A new tag ${NEW_TAG} has been created and pushed!"
|
||||||
|
echo "No open PR found for branch ${{ inputs.branch }}."
|
||||||
|
fi
|
||||||
8
.github/workflows/go.yml
vendored
8
.github/workflows/go.yml
vendored
|
|
@ -1,10 +1,10 @@
|
||||||
name: i386 linux tests
|
name: i386 linux tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
# push:
|
||||||
branches: [ master ]
|
# branches: [ master ]
|
||||||
pull_request:
|
# pull_request:
|
||||||
branches: [ master ]
|
# branches: [ master ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -43,3 +43,7 @@ profile.cov
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
tests/spec-tests/
|
tests/spec-tests/
|
||||||
|
|
||||||
|
.terraform
|
||||||
|
terraform.tfstate*
|
||||||
|
.terraform.tfstate.lock.info
|
||||||
|
|
|
||||||
29
terraform/backend/.terraform.lock.hcl
Normal file
29
terraform/backend/.terraform.lock.hcl
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# This file is maintained automatically by "terraform init".
|
||||||
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hashicorp/aws" {
|
||||||
|
version = "5.83.1"
|
||||||
|
constraints = ">= 5.70.0, 5.83.1"
|
||||||
|
hashes = [
|
||||||
|
"h1:8KI8wFWW2iPYVMyNGI75bxgmwy8MjZk4G6Quut5H7x8=",
|
||||||
|
"h1:YEZLk+HoD/Oz9VC0M7UoMTAFEvoqAwfXLgPc+9ndpVU=",
|
||||||
|
"h1:Yy3K7R7881H72rQDzG6qjZVkrWA6DGJzfE21TionY7w=",
|
||||||
|
"h1:jEKbxB3GtA9ak4XXkaIXTMbnu/SDiiqNKDeF/78XrHc=",
|
||||||
|
"h1:vInFMDq9oMs53/i+7IU8hZgmTLhFfng8L8kbuALZxSI=",
|
||||||
|
"zh:0313253c78f195973752c4d1f62bfdd345a9c99c1bc7a612a8c1f1e27d51e49e",
|
||||||
|
"zh:108523f3e9ebc93f7d900c51681f6edbd3f3a56b8a62b0afc31d8214892f91e0",
|
||||||
|
"zh:175b9bf2a00bea6ac1c73796ad77b0e00dcbbde166235017c49377d7763861d8",
|
||||||
|
"zh:1c8bf55b8548bbad683cd6d7bdb03e8840a00b2422dc1529ffb9892820657130",
|
||||||
|
"zh:22338f09bae62d5ff646de00182417f992548da534fee7d98c5d0136d4bd5d7a",
|
||||||
|
"zh:92de1107ec43de60612be5f6255616f16a9cf82d88df1af1c0471b81f3a82c16",
|
||||||
|
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
|
||||||
|
"zh:9c7bfb7afea330e6d90e1466125a8cba3db1ed4043c5da52f737459c89290a6e",
|
||||||
|
"zh:ba59b374d477e5610674b70f5abfe0408e8f809390347372751384151440d3d0",
|
||||||
|
"zh:bd1c433966002f586d63cb1e3e16326991f238bc6beeb2352be36ec651917b0b",
|
||||||
|
"zh:ca2b4d1d02651c15261fffa4b142e45def9a22c6069353f0f663fd2046e268f8",
|
||||||
|
"zh:d8ed98c748f7a3f1a72277cfee9afe346aca39ab319d17402277852551d8f14a",
|
||||||
|
"zh:ed3d8bc89de5f35f3c5f4802ff7c749fda2e2be267f9af4a850694f099960a72",
|
||||||
|
"zh:f698732a4391c3f4d7079b4aaa52389da2a460cac5eed438ed688f147d603689",
|
||||||
|
"zh:f9f51b17f2978394954e9f6ab9ef293b8e11f1443117294ccf87f7f8212b3439",
|
||||||
|
]
|
||||||
|
}
|
||||||
27
terraform/backend/main.tf
Normal file
27
terraform/backend/main.tf
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
module "s3_bucket" {
|
||||||
|
source = "terraform-aws-modules/s3-bucket/aws"
|
||||||
|
version = "4.4.0"
|
||||||
|
|
||||||
|
bucket = "limechain-devops-task-tf-state"
|
||||||
|
acl = "private"
|
||||||
|
|
||||||
|
control_object_ownership = true
|
||||||
|
object_ownership = "ObjectWriter"
|
||||||
|
|
||||||
|
versioning = {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_dynamodb_table" "terraform_lock_table" {
|
||||||
|
name = "terraform-lock-table"
|
||||||
|
billing_mode = "PAY_PER_REQUEST"
|
||||||
|
|
||||||
|
hash_key = "LockID"
|
||||||
|
deletion_protection_enabled = true
|
||||||
|
|
||||||
|
attribute {
|
||||||
|
name = "LockID"
|
||||||
|
type = "S"
|
||||||
|
}
|
||||||
|
}
|
||||||
22
terraform/backend/versions.tf
Normal file
22
terraform/backend/versions.tf
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
bucket = "limechain-devops-task-tf-state"
|
||||||
|
key = "backend/terraform.tfstate"
|
||||||
|
region = "eu-central-1"
|
||||||
|
dynamodb_table = "terraform-lock-table"
|
||||||
|
encrypt = true
|
||||||
|
}
|
||||||
|
|
||||||
|
required_providers {
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.83.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
required_version = ">= 1.9.8"
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = "eu-central-1"
|
||||||
|
}
|
||||||
53
terraform/infra/dev/.terraform.lock.hcl
Normal file
53
terraform/infra/dev/.terraform.lock.hcl
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# This file is maintained automatically by "terraform init".
|
||||||
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hashicorp/aws" {
|
||||||
|
version = "5.83.1"
|
||||||
|
constraints = "5.83.1"
|
||||||
|
hashes = [
|
||||||
|
"h1:8KI8wFWW2iPYVMyNGI75bxgmwy8MjZk4G6Quut5H7x8=",
|
||||||
|
"h1:YEZLk+HoD/Oz9VC0M7UoMTAFEvoqAwfXLgPc+9ndpVU=",
|
||||||
|
"h1:Yy3K7R7881H72rQDzG6qjZVkrWA6DGJzfE21TionY7w=",
|
||||||
|
"h1:jEKbxB3GtA9ak4XXkaIXTMbnu/SDiiqNKDeF/78XrHc=",
|
||||||
|
"h1:vInFMDq9oMs53/i+7IU8hZgmTLhFfng8L8kbuALZxSI=",
|
||||||
|
"zh:0313253c78f195973752c4d1f62bfdd345a9c99c1bc7a612a8c1f1e27d51e49e",
|
||||||
|
"zh:108523f3e9ebc93f7d900c51681f6edbd3f3a56b8a62b0afc31d8214892f91e0",
|
||||||
|
"zh:175b9bf2a00bea6ac1c73796ad77b0e00dcbbde166235017c49377d7763861d8",
|
||||||
|
"zh:1c8bf55b8548bbad683cd6d7bdb03e8840a00b2422dc1529ffb9892820657130",
|
||||||
|
"zh:22338f09bae62d5ff646de00182417f992548da534fee7d98c5d0136d4bd5d7a",
|
||||||
|
"zh:92de1107ec43de60612be5f6255616f16a9cf82d88df1af1c0471b81f3a82c16",
|
||||||
|
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
|
||||||
|
"zh:9c7bfb7afea330e6d90e1466125a8cba3db1ed4043c5da52f737459c89290a6e",
|
||||||
|
"zh:ba59b374d477e5610674b70f5abfe0408e8f809390347372751384151440d3d0",
|
||||||
|
"zh:bd1c433966002f586d63cb1e3e16326991f238bc6beeb2352be36ec651917b0b",
|
||||||
|
"zh:ca2b4d1d02651c15261fffa4b142e45def9a22c6069353f0f663fd2046e268f8",
|
||||||
|
"zh:d8ed98c748f7a3f1a72277cfee9afe346aca39ab319d17402277852551d8f14a",
|
||||||
|
"zh:ed3d8bc89de5f35f3c5f4802ff7c749fda2e2be267f9af4a850694f099960a72",
|
||||||
|
"zh:f698732a4391c3f4d7079b4aaa52389da2a460cac5eed438ed688f147d603689",
|
||||||
|
"zh:f9f51b17f2978394954e9f6ab9ef293b8e11f1443117294ccf87f7f8212b3439",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hashicorp/tls" {
|
||||||
|
version = "4.0.6"
|
||||||
|
constraints = "4.0.6"
|
||||||
|
hashes = [
|
||||||
|
"h1:/sSdjHoiykrPdyBP1JE03V/KDgLXnHZhHcSOYIdDH/A=",
|
||||||
|
"h1:17Y+vdYNKgphpe1/SU5PBnGuYKEJkJZ7MZCnmAwsAGQ=",
|
||||||
|
"h1:QAuzEStYipyCgx5On0Rym6EiFfqXnBQOrgUjBY7MIbU=",
|
||||||
|
"h1:dYSb3V94K5dDMtrBRLPzBpkMTPn+3cXZ/kIJdtFL+2M=",
|
||||||
|
"h1:n3M50qfWfRSpQV9Pwcvuse03pEizqrmYEryxKky4so4=",
|
||||||
|
"zh:10de0d8af02f2e578101688fd334da3849f56ea91b0d9bd5b1f7a243417fdda8",
|
||||||
|
"zh:37fc01f8b2bc9d5b055dc3e78bfd1beb7c42cfb776a4c81106e19c8911366297",
|
||||||
|
"zh:4578ca03d1dd0b7f572d96bd03f744be24c726bfd282173d54b100fd221608bb",
|
||||||
|
"zh:6c475491d1250050765a91a493ef330adc24689e8837a0f07da5a0e1269e11c1",
|
||||||
|
"zh:81bde94d53cdababa5b376bbc6947668be4c45ab655de7aa2e8e4736dfd52509",
|
||||||
|
"zh:abdce260840b7b050c4e401d4f75c7a199fafe58a8b213947a258f75ac18b3e8",
|
||||||
|
"zh:b754cebfc5184873840f16a642a7c9ef78c34dc246a8ae29e056c79939963c7a",
|
||||||
|
"zh:c928b66086078f9917aef0eec15982f2e337914c5c4dbc31dd4741403db7eb18",
|
||||||
|
"zh:cded27bee5f24de6f2ee0cfd1df46a7f88e84aaffc2ecbf3ff7094160f193d50",
|
||||||
|
"zh:d65eb3867e8f69aaf1b8bb53bd637c99c6b649ba3db16ded50fa9a01076d1a27",
|
||||||
|
"zh:ecb0c8b528c7a619fa71852bb3fb5c151d47576c5aab2bf3af4db52588722eeb",
|
||||||
|
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||||
|
]
|
||||||
|
}
|
||||||
3
terraform/infra/dev/dev.auto.tfvars
Normal file
3
terraform/infra/dev/dev.auto.tfvars
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
env = "dev"
|
||||||
|
account_id = "861276097334"
|
||||||
|
region = "eu-central-1"
|
||||||
46
terraform/infra/dev/ecr.tf
Normal file
46
terraform/infra/dev/ecr.tf
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
module "ecr_go-ethereum" {
|
||||||
|
source = "terraform-aws-modules/ecr/aws"
|
||||||
|
version = "2.3.1"
|
||||||
|
|
||||||
|
repository_name = "limechain-devops-task/go-ethereum"
|
||||||
|
repository_type = "private"
|
||||||
|
|
||||||
|
repository_read_write_access_arns = ["arn:aws:iam::${var.account_id}:role/${aws_iam_role.go-ethereum_github_actions.name}"]
|
||||||
|
create_repository_policy = true
|
||||||
|
repository_lifecycle_policy = jsonencode({
|
||||||
|
rules = [
|
||||||
|
{
|
||||||
|
rulePriority = 1,
|
||||||
|
description = "Keep last 20 images",
|
||||||
|
selection = {
|
||||||
|
tagStatus = "any",
|
||||||
|
countType = "imageCountMoreThan",
|
||||||
|
countNumber = 20
|
||||||
|
},
|
||||||
|
action = {
|
||||||
|
type = "expire"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
# Registry Scanning Configuration
|
||||||
|
manage_registry_scanning_configuration = true
|
||||||
|
registry_scan_type = "BASIC"
|
||||||
|
registry_scan_rules = [
|
||||||
|
{
|
||||||
|
scan_frequency = "SCAN_ON_PUSH"
|
||||||
|
filter = [
|
||||||
|
{
|
||||||
|
filter = "*"
|
||||||
|
filter_type = "WILDCARD"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
"Name" = "limechain-devops-task"
|
||||||
|
"Environment" = var.env
|
||||||
|
}
|
||||||
|
}
|
||||||
68
terraform/infra/dev/gha_iam.tf
Normal file
68
terraform/infra/dev/gha_iam.tf
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
|
||||||
|
### IAM for go-ethereum Github Actions
|
||||||
|
resource "aws_iam_role" "go-ethereum_github_actions" {
|
||||||
|
name = "go-ethereum-github-actions-role"
|
||||||
|
|
||||||
|
assume_role_policy = jsonencode({
|
||||||
|
Version = "2012-10-17",
|
||||||
|
Statement = [
|
||||||
|
{
|
||||||
|
Effect = "Allow",
|
||||||
|
Principal = {
|
||||||
|
Federated = "arn:aws:iam::${var.account_id}:oidc-provider/token.actions.githubusercontent.com"
|
||||||
|
},
|
||||||
|
Action = "sts:AssumeRoleWithWebIdentity",
|
||||||
|
Condition = {
|
||||||
|
StringLike = {
|
||||||
|
"token.actions.githubusercontent.com:sub" : "repo:teddy931130/go-ethereum:*"
|
||||||
|
},
|
||||||
|
StringEquals = {
|
||||||
|
"token.actions.githubusercontent.com:aud" : "sts.amazonaws.com",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
"Name" = "go-ethereum"
|
||||||
|
"Environment" = var.env
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_iam_policy" "go-ethereum_github_actions_policy" {
|
||||||
|
name = "limechain-go-ethereum-github-actions-ecr-policy"
|
||||||
|
description = "Permissions for Limechain-go-ethereum GitHub Actions to pull images from ECR"
|
||||||
|
|
||||||
|
policy = jsonencode({
|
||||||
|
Version = "2012-10-17",
|
||||||
|
Statement = [
|
||||||
|
{
|
||||||
|
Effect = "Allow",
|
||||||
|
Action = [
|
||||||
|
"ecr:BatchCheckLayerAvailability",
|
||||||
|
"ecr:BatchGetImage",
|
||||||
|
"ecr:GetDownloadUrlForLayer",
|
||||||
|
"ecr:DescribeImages",
|
||||||
|
"ecr:InitiateLayerUpload",
|
||||||
|
"ecr:UploadLayerPart",
|
||||||
|
"ecr:CompleteLayerUpload",
|
||||||
|
"ecr:PutImage",
|
||||||
|
],
|
||||||
|
Resource = "arn:aws:ecr:${var.region}:${var.account_id}:repository/limechain-devops-task/go-ethereum"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Effect = "Allow",
|
||||||
|
Action = [
|
||||||
|
"ecr:GetAuthorizationToken"
|
||||||
|
],
|
||||||
|
Resource = "*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_iam_role_policy_attachment" "go-ethereum_github_actions_attach" {
|
||||||
|
role = aws_iam_role.go-ethereum_github_actions.name
|
||||||
|
policy_arn = aws_iam_policy.go-ethereum_github_actions_policy.arn
|
||||||
|
}
|
||||||
20
terraform/infra/dev/oidc.tf
Normal file
20
terraform/infra/dev/oidc.tf
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
data "tls_certificate" "github_oidc" {
|
||||||
|
url = "https://token.actions.githubusercontent.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_iam_openid_connect_provider" "github" {
|
||||||
|
url = "https://token.actions.githubusercontent.com"
|
||||||
|
|
||||||
|
client_id_list = [
|
||||||
|
"sts.amazonaws.com",
|
||||||
|
]
|
||||||
|
|
||||||
|
thumbprint_list = [
|
||||||
|
for cert in data.tls_certificate.github_oidc.certificates : cert.sha1_fingerprint
|
||||||
|
]
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Name = "DevOps task - GitHub OIDC Provider"
|
||||||
|
Environment = var.env
|
||||||
|
}
|
||||||
|
}
|
||||||
14
terraform/infra/dev/variables.tf
Normal file
14
terraform/infra/dev/variables.tf
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
variable "env" {
|
||||||
|
description = "The environment for the deployment"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "account_id" {
|
||||||
|
description = "The AWS account ID"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "region" {
|
||||||
|
description = "The AWS region for creating resources"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
26
terraform/infra/dev/versions.tf
Normal file
26
terraform/infra/dev/versions.tf
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
bucket = "limechain-devops-task-tf-state"
|
||||||
|
key = "dev/terraform.tfstate"
|
||||||
|
region = "eu-central-1"
|
||||||
|
dynamodb_table = "terraform-lock-table"
|
||||||
|
encrypt = true
|
||||||
|
}
|
||||||
|
|
||||||
|
required_providers {
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.83.1"
|
||||||
|
}
|
||||||
|
tls = {
|
||||||
|
source = "hashicorp/tls"
|
||||||
|
version = "4.0.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
required_version = ">= 1.9.8"
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = var.region
|
||||||
|
}
|
||||||
29
terraform/infra/prod/.terraform.lock.hcl
Normal file
29
terraform/infra/prod/.terraform.lock.hcl
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# This file is maintained automatically by "terraform init".
|
||||||
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hashicorp/aws" {
|
||||||
|
version = "5.83.1"
|
||||||
|
constraints = "5.83.1"
|
||||||
|
hashes = [
|
||||||
|
"h1:8KI8wFWW2iPYVMyNGI75bxgmwy8MjZk4G6Quut5H7x8=",
|
||||||
|
"h1:YEZLk+HoD/Oz9VC0M7UoMTAFEvoqAwfXLgPc+9ndpVU=",
|
||||||
|
"h1:Yy3K7R7881H72rQDzG6qjZVkrWA6DGJzfE21TionY7w=",
|
||||||
|
"h1:jEKbxB3GtA9ak4XXkaIXTMbnu/SDiiqNKDeF/78XrHc=",
|
||||||
|
"h1:vInFMDq9oMs53/i+7IU8hZgmTLhFfng8L8kbuALZxSI=",
|
||||||
|
"zh:0313253c78f195973752c4d1f62bfdd345a9c99c1bc7a612a8c1f1e27d51e49e",
|
||||||
|
"zh:108523f3e9ebc93f7d900c51681f6edbd3f3a56b8a62b0afc31d8214892f91e0",
|
||||||
|
"zh:175b9bf2a00bea6ac1c73796ad77b0e00dcbbde166235017c49377d7763861d8",
|
||||||
|
"zh:1c8bf55b8548bbad683cd6d7bdb03e8840a00b2422dc1529ffb9892820657130",
|
||||||
|
"zh:22338f09bae62d5ff646de00182417f992548da534fee7d98c5d0136d4bd5d7a",
|
||||||
|
"zh:92de1107ec43de60612be5f6255616f16a9cf82d88df1af1c0471b81f3a82c16",
|
||||||
|
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
|
||||||
|
"zh:9c7bfb7afea330e6d90e1466125a8cba3db1ed4043c5da52f737459c89290a6e",
|
||||||
|
"zh:ba59b374d477e5610674b70f5abfe0408e8f809390347372751384151440d3d0",
|
||||||
|
"zh:bd1c433966002f586d63cb1e3e16326991f238bc6beeb2352be36ec651917b0b",
|
||||||
|
"zh:ca2b4d1d02651c15261fffa4b142e45def9a22c6069353f0f663fd2046e268f8",
|
||||||
|
"zh:d8ed98c748f7a3f1a72277cfee9afe346aca39ab319d17402277852551d8f14a",
|
||||||
|
"zh:ed3d8bc89de5f35f3c5f4802ff7c749fda2e2be267f9af4a850694f099960a72",
|
||||||
|
"zh:f698732a4391c3f4d7079b4aaa52389da2a460cac5eed438ed688f147d603689",
|
||||||
|
"zh:f9f51b17f2978394954e9f6ab9ef293b8e11f1443117294ccf87f7f8212b3439",
|
||||||
|
]
|
||||||
|
}
|
||||||
1
terraform/infra/prod/prod.auto.tfvars
Normal file
1
terraform/infra/prod/prod.auto.tfvars
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
env = "prod"
|
||||||
4
terraform/infra/prod/variables.tf
Normal file
4
terraform/infra/prod/variables.tf
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
variable "env" {
|
||||||
|
description = "The environment for the deployment"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
22
terraform/infra/prod/versions.tf
Normal file
22
terraform/infra/prod/versions.tf
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
bucket = "limechain-devops-task-tf-state"
|
||||||
|
key = "prod/terraform.tfstate"
|
||||||
|
region = "eu-central-1"
|
||||||
|
dynamodb_table = "terraform-lock-table"
|
||||||
|
encrypt = true
|
||||||
|
}
|
||||||
|
|
||||||
|
required_providers {
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.83.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
required_version = ">= 1.9.8"
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = "eu-central-1"
|
||||||
|
}
|
||||||
29
terraform/infra/stage/.terraform.lock.hcl
Normal file
29
terraform/infra/stage/.terraform.lock.hcl
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# This file is maintained automatically by "terraform init".
|
||||||
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hashicorp/aws" {
|
||||||
|
version = "5.83.1"
|
||||||
|
constraints = "5.83.1"
|
||||||
|
hashes = [
|
||||||
|
"h1:8KI8wFWW2iPYVMyNGI75bxgmwy8MjZk4G6Quut5H7x8=",
|
||||||
|
"h1:YEZLk+HoD/Oz9VC0M7UoMTAFEvoqAwfXLgPc+9ndpVU=",
|
||||||
|
"h1:Yy3K7R7881H72rQDzG6qjZVkrWA6DGJzfE21TionY7w=",
|
||||||
|
"h1:jEKbxB3GtA9ak4XXkaIXTMbnu/SDiiqNKDeF/78XrHc=",
|
||||||
|
"h1:vInFMDq9oMs53/i+7IU8hZgmTLhFfng8L8kbuALZxSI=",
|
||||||
|
"zh:0313253c78f195973752c4d1f62bfdd345a9c99c1bc7a612a8c1f1e27d51e49e",
|
||||||
|
"zh:108523f3e9ebc93f7d900c51681f6edbd3f3a56b8a62b0afc31d8214892f91e0",
|
||||||
|
"zh:175b9bf2a00bea6ac1c73796ad77b0e00dcbbde166235017c49377d7763861d8",
|
||||||
|
"zh:1c8bf55b8548bbad683cd6d7bdb03e8840a00b2422dc1529ffb9892820657130",
|
||||||
|
"zh:22338f09bae62d5ff646de00182417f992548da534fee7d98c5d0136d4bd5d7a",
|
||||||
|
"zh:92de1107ec43de60612be5f6255616f16a9cf82d88df1af1c0471b81f3a82c16",
|
||||||
|
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
|
||||||
|
"zh:9c7bfb7afea330e6d90e1466125a8cba3db1ed4043c5da52f737459c89290a6e",
|
||||||
|
"zh:ba59b374d477e5610674b70f5abfe0408e8f809390347372751384151440d3d0",
|
||||||
|
"zh:bd1c433966002f586d63cb1e3e16326991f238bc6beeb2352be36ec651917b0b",
|
||||||
|
"zh:ca2b4d1d02651c15261fffa4b142e45def9a22c6069353f0f663fd2046e268f8",
|
||||||
|
"zh:d8ed98c748f7a3f1a72277cfee9afe346aca39ab319d17402277852551d8f14a",
|
||||||
|
"zh:ed3d8bc89de5f35f3c5f4802ff7c749fda2e2be267f9af4a850694f099960a72",
|
||||||
|
"zh:f698732a4391c3f4d7079b4aaa52389da2a460cac5eed438ed688f147d603689",
|
||||||
|
"zh:f9f51b17f2978394954e9f6ab9ef293b8e11f1443117294ccf87f7f8212b3439",
|
||||||
|
]
|
||||||
|
}
|
||||||
1
terraform/infra/stage/stage.auto.tfvars
Normal file
1
terraform/infra/stage/stage.auto.tfvars
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
env = "stage"
|
||||||
4
terraform/infra/stage/variables.tf
Normal file
4
terraform/infra/stage/variables.tf
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
variable "env" {
|
||||||
|
description = "The environment for the deployment"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
22
terraform/infra/stage/versions.tf
Normal file
22
terraform/infra/stage/versions.tf
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
terraform {
|
||||||
|
backend "s3" {
|
||||||
|
bucket = "limechain-devops-task-tf-state"
|
||||||
|
key = "stage/terraform.tfstate"
|
||||||
|
region = "eu-central-1"
|
||||||
|
dynamodb_table = "terraform-lock-table"
|
||||||
|
encrypt = true
|
||||||
|
}
|
||||||
|
|
||||||
|
required_providers {
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "5.83.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
required_version = ">= 1.9.8"
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "aws" {
|
||||||
|
region = "eu-central-1"
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue