This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: 0.2 | |
| phases: | |
| pre_build: | |
| commands: | |
| - echo Logging in to Amazon ECR... | |
| - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com | |
| - IMAGE_TAG=${CODEBUILD_RESOLVED_SOURCE_VERSION:=latest} | |
| - IMAGE_REPO_CREATE_URL=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_CREATE | |
| - IMAGE_REPO_GET_URL=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_GET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #For your lambda to connect to a local dynamoDb , the two components should share the same docker network | |
| #as sam build runs a docker process. The AWS endpoint inside your source code should be http://docker.for.mac.localhost:8000 for mac | |
| # Or http://localhost:8000 for linux OS | |
| default: docker_network docker_run aws_create_table aws_lambda_invoke | |
| docker_network: | |
| docker network create networktest | |
| docker_run: | |
| docker run -d -p 8000:8000 --network networktest --name dynamodblocal amazon/dynamodb-local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: IAC codepipeline - codebuild | |
| on: | |
| push: | |
| branches: [ "serverless-system-deploy" ] | |
| env: | |
| AWS_REGION: ca-central-1 | |
| ASSUME_ROLE: arn:aws:iam::516193157210:role/base-app-role | |
| permissions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Terragrunt GitHub Actions for base-app' | |
| on: | |
| push: | |
| branches: [ "iac*" ] | |
| env: | |
| AWS_REGION: ca-central-1 | |
| ASSUME_ROLE: arn:aws:iam::516193157210:role/base-app-role | |
| TFC_API_TOKEN: ${{ secrets.TFC_API_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_ecs_cluster_capacity_providers" "base_app_aws_ecs_cluster_capacity_providers" { | |
| cluster_name = aws_ecs_cluster.base_app_aws_ecs_cluster.name | |
| capacity_providers = [aws_ecs_capacity_provider.base_app_aws_ecs_capacity_provider.name,"FARGATE","FARGATE_SPOT"] | |
| } | |
| resource "aws_ecs_capacity_provider" "base_app_aws_ecs_capacity_provider" { | |
| name = "base-app-capacity-provider" | |
| auto_scaling_group_provider { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_ecr_repository" "base-app-repository" { | |
| name = "base-app-repo" | |
| image_tag_mutability = "IMMUTABLE" | |
| tags = { | |
| name = "base-app" | |
| subject = "github" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_codebuild_webhook" "base_app_codebuild_webhook" { | |
| project_name = aws_codebuild_project.base_app_codebuild.name | |
| build_type = "BUILD" | |
| filter_group { | |
| filter { | |
| type = "EVENT" | |
| pattern = "PUSH,PULL_REQUEST_CREATED,PULL_REQUEST_UPDATED" | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if err := app.Run(os.Args); err != nil { | |
| log.Fatal(err) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Flags: []cli.Flag{ | |
| &cli.StringFlag{ | |
| Name: "key", | |
| Aliases: []string{"k"}, | |
| Usage: "(Required)-Cypher key used for encryption/decryption, It's length should be a multiple of 16", | |
| Destination: &key, | |
| }, | |
| &cli.StringFlag{ | |
| Name: "text", | |
| Aliases: []string{"t"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Commands: []*cli.Command{ | |
| { | |
| Name: "encrypt", | |
| Aliases: []string{"e"}, | |
| Usage: "encrypt a text", | |
| Action: func(*cli.Context) error { | |
| cypherText, err := encryption.Encrypt(text, key) | |
| if err != nil { | |
| return cli.Exit("Input parameters are not valid for encryption, please provide valid key or text!", 86) | |
| } |