Git Product home page Git Product logo

terraform-aws-devops's Introduction

Manage AWS infrastructure as code using Terraform

Join AWS User Group Norway meetups!

This is a group for people interested in Amazon Web Services. Anyone can participate, ranging from AWS evangelists to the curious. The main focus of the group is to build up a community around AWS with socializing and talks on topics like innovations, development and possibilities. Having trouble with a stack? Maybe you'll meet someone with a solution or an approach that you haven't already tried.

Join now!

Presentation

Talk was given by Anton Babenko on DevOps Norway Meetup 14th of December 2015.

Slides from the talk

Video recording

Setup

Install Terraform - https://www.terraform.io/intro/getting-started/install.html

Install AWS CLI - brew update && brew install awscli (on Mac)

Get AWS IAM access and secret keys from AWS console and export them like this:

export AWS_ACCESS_KEY_ID="something_here"
export AWS_SECRET_ACCESS_KEY="something_secret_here"
export TF_VAR_aws_access_key=$AWS_ACCESS_KEY_ID
export TF_VAR_aws_secret_key=$AWS_SECRET_ACCESS_KEY

Description

Let's deploy demo application and work with AWS infrastructure as code using Terraform.

Terraform remote state is configured using S3.

2 projects:

  • web (ELB,ASG,LC)
  • shared-aws (VPC,SN) 1 environment:
  • production 1 region:
  • eu-west-1

Want to destroy? Tired of cycle errors?

If you run ./terraform.sh heavy production plan-destroy it will raise cycle error like:

Error running plan: 1 error(s) occurred:

* Cycle: aws_security_group.elb, aws_security_group.elb (destroy), aws_iam_instance_profile.default (destroy), aws_iam_role.default (destroy), aws_iam_role.default, aws_iam_instance_profile.default, aws_security_group.web_server, aws_launch_configuration.heavy, aws_launch_configuration.heavy (destroy), aws_security_group.web_server (destroy), output.configuration, aws_elb.heavy (destroy), aws_autoscaling_group.heavy (destroy), terraform_remote_state.shared (destroy), terraform_remote_state.shared, aws_elb.heavy, aws_autoscaling_group.heavy

It happens because resource terraform_remote_state.shared does not have lifecycle event defined, so we should destroy all except it:

cd projects/heavy
terraform destroy -var-file=production.tfvars -var-file=terraform.tfvars -var 'environment=production' \
-target=aws_iam_instance_profile.default \
-target=aws_elb.heavy \
-target=aws_security_group.web_server \
-target=template_file.heavy_user_data \
-target=aws_iam_role.default \
-target=aws_security_group.elb

Author

Created and maintained by Anton Babenko.

Feel free to open github issue, if you found something wrong or just have questions.

License

Apache 2 Licensed. See LICENSE for full details.

terraform-aws-devops's People

Contributors

antonbabenko avatar

Watchers

 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.