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": "2012–10–17", | |
| "Statement": [ | |
| { | |
| "Sid": "", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Service": "apigateway.amazonaws.com" | |
| }, | |
| "Action": "sts:AssumeRole" |
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
| const TOKEN = process.env.TOKEN; | |
| const generatePolicy = (effect, methodArn) => { | |
| return { | |
| 'policyDocument': { | |
| 'Version': '2012-10-17', | |
| 'Statement': [ | |
| { | |
| 'Sid': '1', | |
| 'Action': 'execute-api:Invoke', |
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
| # Build linux binary | |
| GOOS=linux go build -o main main.go | |
| # Create a zip file | |
| zip deployment.zip main |
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
| def bucket = 'deployment-packages-mlabouardy' | |
| def functionName = 'Fibonacci' | |
| def region = 'eu-west-3' | |
| node('slaves'){ | |
| stage('Checkout'){ | |
| checkout scm | |
| } | |
| stage('Test'){ |
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
| aws lambda create-alias --function-name Fibonacci \ | |
| --name production --function-version 2 \ | |
| --region eu-west-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
| def bucket = 'deployment-packages-mlabouardy' | |
| def functionName = 'Fibonacci' | |
| def region = 'eu-west-3' | |
| node('slaves'){ | |
| stage('Checkout'){ | |
| checkout scm | |
| } | |
| stage('Test'){ |
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
| def bucket = 'deployment-packages-mlabouardy' | |
| def functionName = 'Fibonacci' | |
| def region = 'eu-west-3' | |
| node('slaves'){ | |
| stage('Checkout'){ | |
| checkout scm | |
| } | |
| stage('Test'){ |
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
| // Lambda function | |
| resource "aws_lambda_function" "function" { | |
| filename = "deployment.zip" | |
| function_name = "Fibonacci" | |
| role = "${aws_iam_role.lambda_role.arn}" | |
| handler = "main" | |
| runtime = "go1.x" | |
| } |
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
| // Lambda IAM role | |
| resource "aws_iam_role" "lambda_role" { | |
| name = "FibonacciFunctionRole" | |
| path = "/" | |
| assume_role_policy = <<EOF | |
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { |
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
| // Jenkins slave instance profile | |
| resource "aws_iam_instance_profile" "worker_profile" { | |
| name = "JenkinsWorkerProfile" | |
| role = "${aws_iam_role.worker_role.name}" | |
| } | |
| resource "aws_iam_role" "worker_role" { | |
| name = "JenkinsBuildRole" | |
| path = "/" |