Giter Site home page Giter Site logo

s-schumann-fork / immutableinfrastructure Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miteshsharma/immutableinfrastructure

0.0 1.0 0.0 7 KB

Creating immutable infrastructure using Packer, Ansible and Terraform

License: MIT License

HTML 2.17% HCL 97.83%

immutableinfrastructure's Introduction

Immutable Infrastructure Using Packer, Ansible, and Terraform

We are going to use ansible code for provisioning static website using nginx during the baking process. We need to make sure nginx is enabled in systemctl and starts on every boot so it is ready to process on instance start. We are going assign tags in bake process to AMI. This tag is used by Terraform to identify the latest AMI available and use it for EC2 instance creation. We need to provide subnet id to packer builder so it can use this subnet id while creating AMI. We are going to divide our terraform code into two parts, one which contains all network details: create VPC, subnet, and other network details. Another part which spawns our EC2 instance inside our network using AMI generated by the packer.

Getting Started

Step 1: Setup a network using Terraform

Step 2: Create AMI using packer and ansible inside the above-created network

Step 3: Setup EC2 instance inside the network with packer AMI

Provide access key and token in Terraform and Packer code.

Command to run network Terraform

Go in folder networkTerraform, run command:

  1. terraform init

  2. terraform plan

  3. terraform apply

Command to run Packer

Provide subnet id created in network terraform in packer.json

packer build packer.json

Command to run main Terraform

Go in folder terraform, run command:

  1. terraform init

  2. terraform plan

  3. terraform apply

immutableinfrastructure's People

Contributors

miteshsharma avatar

Watchers

James Cloos avatar

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.