Git Product home page Git Product logo

terraform-aws's Introduction

terraform-aws

Useful to quickly spin up some test droplets on AWS.

Configure provider

Full docs here.

Generate a set of access keys in the AWS console and if you'd like to ENV vars you can do so thus:

# Configure the AWS Provider
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region     = "us-east-1"
}

Alternatively a shared credentials file (in clear text on disk!) can be specified thus:

provider "aws" {
region                  = "eu-west-1"
shared_credentials_file = "/home/user/.aws/creds"
}

Note if you have performed aws configure you have most likely already got a plain text file on disk with this information under ~/.aws/credentials. Unless, you're using IAM roles of course - which you should be.

Dynamic Inventory (for Ansible)

Once created if you'd like run Ansible against these hosts (separately from TF) then you can use the included ec2.py script in the aws-ansible-dynamic-inventory folder.

[alex@neo terraform-aws]$ ansible-console -u ec2-user -i aws-ansible-dynamic-inventory/ -b
    Welcome to the ansible console.
    Type help or ? to list commands.

    ec2-user@all (3)[f:5]# ping
    34.253.216.159 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    34.250.188.249 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }
    34.241.194.55 | SUCCESS => {
        "changed": false,
        "ping": "pong"
    }

If you'd like to avoid specifying a key pair everytime you run Ansible, the following snippet in your ~/.ssh/config will help.

Host 34.*
  IdentityFile ~/.ssh/neo.pem
  User ec2-user

terraform-aws's People

Contributors

ironicbadger avatar

Stargazers

 avatar  avatar Neil Kidd avatar

Watchers

James Cloos avatar  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.