├── .gitignore ├── sample-templates └── sample-lambda-function-template │ └── v1 │ └── .compatible-envs ├── wiki └── assets │ ├── flow_chart.png │ └── env_pr_created.png ├── env_config.json ├── my_first_tf_env_2 ├── proton.auto.tfvars.json ├── .proton │ └── deployment-metadata.json ├── Fourth-attempt-tf-fourth-tf-instance │ ├── outputs.tf │ ├── .proton │ │ └── deployment-metadata.json │ ├── config.tf │ ├── proton.auto.tfvars.json │ ├── proton.service_instance.variables.tf │ └── lambda.tf ├── proton.environment.variables.tf ├── config.tf ├── outputs.tf └── vpc.tf ├── CODE_OF_CONDUCT.md ├── LICENSE ├── GitHubConfiguration.yaml ├── CONTRIBUTING.md ├── README.md └── .github └── workflows └── proton_run.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /sample-templates/sample-lambda-function-template/v1/.compatible-envs: -------------------------------------------------------------------------------- 1 | sample-vpc-environment-template:1 2 | -------------------------------------------------------------------------------- /wiki/assets/flow_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-proton-terraform-github-actions-sample/HEAD/wiki/assets/flow_chart.png -------------------------------------------------------------------------------- /wiki/assets/env_pr_created.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-proton-terraform-github-actions-sample/HEAD/wiki/assets/env_pr_created.png -------------------------------------------------------------------------------- /env_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "REPLACE_ME": { 3 | "role": "arn:aws:iam::111111111111:role/REPLACE_ME", 4 | "region": "us-west-2", 5 | "state_bucket":"REPLACE_ME" 6 | } 7 | } -------------------------------------------------------------------------------- /my_first_tf_env_2/proton.auto.tfvars.json: -------------------------------------------------------------------------------- 1 | { 2 | "environment" : { 3 | "name" : "my_first_tf_env_2", 4 | "inputs" : { 5 | "vpc_name" : "my_tf_vpc" 6 | } 7 | }, 8 | "//" : "arn:aws:proton:us-east-1:987544922694:environment/my_first_tf_env_2" 9 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /my_first_tf_env_2/.proton/deployment-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploymentId" : "fcda9f18-f569-4079-8474-0832f45b97ea", 3 | "isResourceDeleted" : false, 4 | "resourceMetadata" : { 5 | "arn" : "arn:aws:proton:us-east-1:987544922694:environment/my_first_tf_env_2", 6 | "templateArn" : "arn:aws:proton:us-east-1:987544922694:environment-template/sample-vpc-environment-template", 7 | "templateMajorVersion" : "1", 8 | "templateMinorVersion" : "0" 9 | } 10 | } -------------------------------------------------------------------------------- /my_first_tf_env_2/Fourth-attempt-tf-fourth-tf-instance/outputs.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:service/Fourth-attempt-tf/service-instance/fourth-tf-instance 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | output "lambda_arn" { 10 | value = "whocares" 11 | } -------------------------------------------------------------------------------- /my_first_tf_env_2/proton.environment.variables.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:environment/my_first_tf_env_2 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | variable "environment" { 10 | type = object({ 11 | inputs = map(string) 12 | name = string 13 | }) 14 | default = null 15 | } 16 | 17 | -------------------------------------------------------------------------------- /my_first_tf_env_2/Fourth-attempt-tf-fourth-tf-instance/.proton/deployment-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "deploymentId" : "cd9a940c-7d24-40bd-8d75-186387284867", 3 | "isResourceDeleted" : false, 4 | "resourceMetadata" : { 5 | "arn" : "arn:aws:proton:us-east-1:987544922694:service/Fourth-attempt-tf/service-instance/fourth-tf-instance", 6 | "templateArn" : "arn:aws:proton:us-east-1:987544922694:service-template/sample-lambda-function-template", 7 | "templateMajorVersion" : "1", 8 | "templateMinorVersion" : "0", 9 | "environmentArn" : "arn:aws:proton:us-east-1:987544922694:environment/my_first_tf_env_2" 10 | } 11 | } -------------------------------------------------------------------------------- /my_first_tf_env_2/config.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:environment/my_first_tf_env_2 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | terraform { 10 | required_providers { 11 | aws = { 12 | source = "hashicorp/aws" 13 | version = "~> 3.0" 14 | } 15 | } 16 | 17 | backend "s3" {} 18 | } 19 | 20 | # Configure the AWS Provider 21 | provider "aws" {} 22 | 23 | variable "aws_region" { 24 | type = string 25 | } 26 | -------------------------------------------------------------------------------- /my_first_tf_env_2/outputs.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:environment/my_first_tf_env_2 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | output "vpc_arn" { 10 | value = module.vpc.vpc_arn 11 | } 12 | 13 | output "subnet_id" { 14 | value = one(module.vpc.private_subnets) # there is a known issue with terraform lists as outputs for proton 15 | } 16 | 17 | output "security_group_id" { 18 | value = module.vpc.default_security_group_id 19 | } -------------------------------------------------------------------------------- /my_first_tf_env_2/Fourth-attempt-tf-fourth-tf-instance/config.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:service/Fourth-attempt-tf/service-instance/fourth-tf-instance 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | terraform { 10 | required_providers { 11 | aws = { 12 | source = "hashicorp/aws" 13 | version = "~> 3.0" 14 | } 15 | } 16 | 17 | backend "s3" {} 18 | } 19 | 20 | # Configure the AWS Provider 21 | provider "aws" {} 22 | 23 | variable "aws_region" { 24 | type = string 25 | } 26 | -------------------------------------------------------------------------------- /my_first_tf_env_2/vpc.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:environment/my_first_tf_env_2 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | module "vpc" { 10 | source = "terraform-aws-modules/vpc/aws" 11 | 12 | name = var.environment.inputs.vpc_name 13 | cidr = "10.0.0.0/16" 14 | 15 | azs = ["${var.aws_region}a"] 16 | private_subnets = ["10.0.1.0/24"] 17 | public_subnets = ["10.0.101.0/24"] 18 | 19 | enable_nat_gateway = true 20 | enable_vpn_gateway = true 21 | 22 | tags = { 23 | Terraform = "true" 24 | Environment = var.environment.name 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /my_first_tf_env_2/Fourth-attempt-tf-fourth-tf-instance/proton.auto.tfvars.json: -------------------------------------------------------------------------------- 1 | { 2 | "environment" : { 3 | "account_id" : "987544922694", 4 | "name" : "my_first_tf_env_2", 5 | "outputs" : { 6 | "security_group_id" : "sg-070e9604b5be86bf9", 7 | "subnet_id" : "subnet-08a92ece5f555dcab", 8 | "vpc_arn" : "arn:aws:ec2:us-east-1:987544922694:vpc/vpc-0eebeefc7abf77b0b" 9 | } 10 | }, 11 | "service" : { 12 | "name" : "Fourth-attempt-tf" 13 | }, 14 | "service_instance" : { 15 | "name" : "fourth-tf-instance", 16 | "inputs" : { 17 | "function_name" : "one-function", 18 | "handler" : "lamba_function.lambda_handler", 19 | "lambda_runtime" : "python3.8", 20 | "function_s3_bucket" : "my-lambda-bucket-for-tf", 21 | "function_s3_key" : "deployment-package.zip" 22 | } 23 | }, 24 | "//" : "arn:aws:proton:us-east-1:987544922694:service/Fourth-attempt-tf/service-instance/fourth-tf-instance" 25 | } -------------------------------------------------------------------------------- /my_first_tf_env_2/Fourth-attempt-tf-fourth-tf-instance/proton.service_instance.variables.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:service/Fourth-attempt-tf/service-instance/fourth-tf-instance 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | variable "environment" { 10 | type = object({ 11 | account_id = string 12 | name = string 13 | outputs = map(string) 14 | }) 15 | default = null 16 | } 17 | 18 | variable "service" { 19 | type = object({ 20 | name = string 21 | }) 22 | } 23 | 24 | variable "service_instance" { 25 | type = object({ 26 | name = string 27 | inputs = map(string) 28 | }) 29 | default = null 30 | } 31 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | 16 | -------------------------------------------------------------------------------- /my_first_tf_env_2/Fourth-attempt-tf-fourth-tf-instance/lambda.tf: -------------------------------------------------------------------------------- 1 | /* 2 | This file is managed by AWS Proton. Any changes made directly to this file will be overwritten the next time AWS Proton performs an update. 3 | 4 | To manage this resource, see AWS Proton Resource: arn:aws:proton:us-east-1:987544922694:service/Fourth-attempt-tf/service-instance/fourth-tf-instance 5 | 6 | If the resource is no longer accessible within AWS Proton, it may have been deleted and may require manual cleanup. 7 | */ 8 | 9 | resource "aws_iam_role" "iam_for_lambda" { 10 | name = "iam_for_lambda" 11 | 12 | managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"] 13 | 14 | assume_role_policy = <