Skip to content

Commit

Permalink
Merge pull request #2 from yangwu1227/terraform
Browse files Browse the repository at this point in the history
feat: terraform
  • Loading branch information
yangwu1227 committed Dec 1, 2024
2 parents 41951f3 + 8e9fd99 commit cf982b2
Show file tree
Hide file tree
Showing 41 changed files with 1,290 additions and 217 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ecr_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
paths:
- Dockerfile
- src/**
- '!src/deploy_stack.py' # Exclude the deploy_stack.py file from triggering the workflow
- main.py
- pyproject.toml
- poetry.lock
Expand All @@ -34,7 +33,7 @@ jobs:
audience: sts.amazonaws.com
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE_ARN }}
role-session-name: BuildAndPushECR
role-session-name: build-and-push

- name: Log in to Amazon ECR
id: login-ecr
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lambda_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
audience: sts.amazonaws.com
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE_ARN }}
role-session-name: DeployLambdaFunction
role-session-name: deploy-lambda

- name: Package and Zip Lambda function
id: package-zip-lambda
Expand Down
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,41 @@ cython_debug/
yfinance.cache

cloudformation_templates/stack_parameters_prod.json

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore transient lock info files created by terraform apply
.terraform.tfstate.lock.info

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc
34 changes: 17 additions & 17 deletions cloudformation_templates/stack_parameters.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"vpc-private.yaml": {
"StackName": "etf-kpis-scraper-vpc"
"StackName": "etf_kpis_scraper_vpc"
},
"s3-ecr.yaml": {
"StackName": "etf-kpis-scraper-s3-ecr",
"S3BucketName": "etf-kpis-scraper",
"ECRRepoName": "etf-kpis-scraper"
"StackName": "etf_kpis_scraper_s3_ecr",
"S3BucketName": "etf_kpis_scraper",
"ECRRepoName": "etf_kpis_scraper"
},
"iam.yaml": {
"StackName": "etf-kpis-scraper-iam",
"S3BucketName": "etf-kpis-scraper",
"ECRRepoName": "etf-kpis-scraper",
"ECRRepoArn": "arn:aws:ecr:region:account_id:repository/etf-kpis-scraper",
"StackName": "etf_kpis_scraper_iam",
"S3BucketName": "etf_kpis_scraper",
"ECRRepoName": "etf_kpis_scraper",
"ECRRepoArn": "arn:aws:ecr:region:account_id:repository/etf_kpis_scraper",
"GithubUsername": "github_username",
"GithubRepoName": "github_repo_name"
},
"lambda-eventbridge.yaml": {
"StackName": "etf-kpis-scraper-lambda-eventbridge",
"S3BucketName": "etf-kpis-scraper",
"EventBridgeScheduleExpression": "cron(00 22 ? * MON-FRI *)",
"LambdaExecutionRoleArn": "arn:aws:iam::region:account_id:role/etf-kpis-scraper-iam-lambda-execution-role",
"StackName": "etf_kpis_scraper_lambda_eventbridge",
"S3BucketName": "etf_kpis_scraper",
"EventBridgeScheduleExpression": "cron(00 22 ? * MON_FRI *)",
"LambdaExecutionRoleArn": "arn:aws:iam::region:account_id:role/etf_kpis_scraper_iam_lambda_execution_role",
"Architectures": "x86_64",
"Runtime": "python3.11",
"Timeout": 30
},
"ecs-fargate.yaml": {
"StackName": "etf-kpis-scraper-ecs-fargate",
"ECRRepoName": "etf-kpis-scraper",
"ECSExecutionRoleArn": "arn:aws:iam::account_id:role/etf-kpis-scraper-iam-ecs-execution-role",
"ECSTaskRoleArn": "arn:aws:iam::account_id:role/etf-kpis-scraper-iam-ecs-task-role",
"EnvironmentFileS3Arn": "arn:aws:s3:::etf-kpis-scraper/vars.env",
"StackName": "etf_kpis_scraper_ecs_fargate",
"ECRRepoName": "etf_kpis_scraper",
"ECSExecutionRoleArn": "arn:aws:iam::account_id:role/etf_kpis_scraper_iam_ecs_execution_role",
"ECSTaskRoleArn": "arn:aws:iam::account_id:role/etf_kpis_scraper_iam_ecs_task_role",
"EnvironmentFileS3Arn": "arn:aws:s3:::etf_kpis_scraper/vars.env",
"CpuArchitecture": "x86_64",
"OperatingSystemFamily": "LINUX",
"Cpu": 1024,
Expand Down
197 changes: 0 additions & 197 deletions src/deploy_stack.py

This file was deleted.

25 changes: 25 additions & 0 deletions terraform/ecs_fargate/.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/ecs_fargate/backend.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bucket = "yang-templates"
key = "terraform-states/etf-kpis-scraper/ecs-fargate/terraform.tfstate"
region = "us-east-1"
profile = "admin"
Loading

0 comments on commit cf982b2

Please sign in to comment.