Coder Social home page Coder Social logo

giancarlopetrini / tf-sampleapp Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 6 KB

A sample deployment of Terraform, implementing S3, Lambda, Travis CI, and API Gateway

License: MIT License

HCL 86.49% Go 13.51%
terraform aws aws-lambda go golang travis-ci

tf-sampleapp's Introduction

tf-sampleapp

A sample deployment of Terraform, implementing S3, Lambda, Travis CI, and API Gateway

Accompanying guide available at, -> https://giancarlopetrini.com/terraform-lambda-apigateway/ Please note, some of the file paths have been changed and the .travis.yml has been updated to reflect those changes since the time of writing.

Getting Started

You'll first need to have Travis CI hooked up to your github account and select this/your copy of this repo. You'll also need to have an AWS IAM user created, that's been granted programmatic access. (This can be done through the AWS console.) This example also references a domain that I own and have registered within AWS Route 53. For this to work properly, you'll need a domain that uses Route 53's Nameservers as well.

Next Steps

  1. Within the Travis UI, add the following environmental variables:
    ACCESS_KEY_ID
    SECRET_ACCESS_KEY
    These will correlate with your AWS user credentials.
  2. Update the provider "aws" block within the main.tf file to use the AWS CLI profile that contain the credentials for the proper IAM user.
  3. Update the following resources within the main.tf file with your domain details:
data "aws_route53_zone" "selected" {
  name = "giancarlopetrini.com"
}

resource "aws_acm_certificate" "cert" {
  domain_name       = "apitest.giancarlopetrini.com"
  validation_method = "DNS"
}
  1. terraform init
  2. terraform apply - This will generate an error because the lambda cannot be created as of yet, since no lambda.zip file has been pushed to the S3 bucket. The next step will correct this.
  3. travis open and run build
  4. terraform apply
  5. To validate, POST to the custom created domain and you should get a response message.
  6. To clean it all up, run terraform destroy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.