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_lambda_function" "my_lambda" { | |
| for_each = var.lambdas | |
| filename = data.archive_file.bootstrap_lambda.output_path | |
| function_name = each.value.lambda_name | |
| role = aws_iam_role.lambda_exec.arn | |
| handler = each.value.lambda_entrypoint | |
| runtime = each.value.lambda_runtime | |
| source_code_hash = data.archive_file.bootstrap_lambda.output_base64sha256 | |
| memory_size = each.value.lambda_memory_size |
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
| lambdas = { | |
| my_lambda_1 = { | |
| lambda_name = "my_lambda_1", | |
| lambda_entrypoint = "my_lambda_1.lambda_handler", | |
| } | |
| my_lambda_2 = { | |
| lambda_name = "my_lambda_2", | |
| lambda_entrypoint = "my_lambda_2.lambda_handler", | |
| } | |
| my_lambda_3 = { |
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
| # Gross | |
| lambdas = { | |
| my_lambda_1 = { | |
| lambda_name = "my_lambda_1", | |
| lambda_entrypoint = "my_lambda_1.lambda_handler", | |
| timeout = 900, | |
| lambda_runtime = "python3.7", | |
| lambda_memory_size = 256 | |
| } | |
| my_lambda_2 = { |
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
| remoteRepositories: | |
| docker-remote: | |
| type: docker | |
| url: https://registry-1.docker.io/ | |
| repoLayout: simple-default | |
| blockPushingSchema1: false | |
| enableTokenAuthentication: true | |
| retrievalCachePeriodSecs: 7200 | |
| username: "DOCKER_USER" | |
| password: "PASSWORD" |
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 "artifactory_remote_docker_repository" "docker-remote" { | |
| key = "docker-remote" | |
| url = "https://registry-1.docker.io/" | |
| repo_layout_ref = "simple-default" | |
| block_pushing_schema1 = false | |
| enable_token_authentication = true | |
| retrieval_cache_period_seconds = 7200 | |
| username = "DOCKER_USER" | |
| password = "PASSWORD" | |
| unused_artifacts_cleanup_period_hours = 36 |
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_lambda_function" "parameter_layer_test" { | |
| filename = "${path.module}/lambda_function_payload.zip" | |
| function_name = "parameter_layer_test" | |
| role = aws_iam_role.ssm_lambda_exec.arn | |
| handler = "parameter_layer_test.lambda_handler" | |
| runtime = "python3.9" | |
| source_code_hash = filebase64sha256("${path.module}/lambda_function_payload.zip") | |
| memory_size = 256 | |
| timeout = 900 | |
| layers = ["arn:aws:lambda:eu-west-1:015030872274:layer:AWS-Parameters-and-Secrets-Lambda-Extension:2", ] |
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_iam_role" "ssm_lambda_exec" { | |
| name = "parameter_layer_test-lambda-exec" | |
| assume_role_policy = <<EOF | |
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Action": "sts:AssumeRole", | |
| "Principal": { |
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
| import logging | |
| import os | |
| import requests | |
| # Logging | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.INFO) | |
| aws_session_token = os.environ.get('AWS_SESSION_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
| name: Python Testing | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10"] |
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
| # Get the latest TLS cert from GitHub to authenticate their requests | |
| data "tls_certificate" "github" { | |
| url = "https://token.actions.githubusercontent.com/.well-known/openid-configuration" | |
| } | |
| # Create the OIDC Provider in the AWS Account | |
| resource "aws_iam_openid_connect_provider" "github_actions" { | |
| url = "https://token.actions.githubusercontent.com" | |
| client_id_list = ["sts.amazonaws.com"] | |
| thumbprint_list = [data.tls_certificate.github.certificates[0].sha1_fingerprint] |