Skip to content

Instantly share code, notes, and snippets.

@mooyoul
Created December 30, 2016 23:18
Show Gist options
  • Save mooyoul/2dcef697470220df05a362ad1688b7b6 to your computer and use it in GitHub Desktop.
Save mooyoul/2dcef697470220df05a362ad1688b7b6 to your computer and use it in GitHub Desktop.
Terraform 101 - Module Outputs
variable "access_key" {}
variable "secret_key" {}
variable "region" {
default = "ap-northeast-2"
}
variable "key_name" {}
variable "key_path" {}
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
module "consul" {
# source 속성의 원본 값은 아래와 같으나,
# 현재 Consul의 Terraform의 AWS 템플릿에 서울 리전 (ap-northeast-2) AMI가 정의되지 않아
# AWS 서울 리전으로 사용할 수 없는 문제가 있어 fork한 버전을 대신 사용합니다.
# Consul PR URL: https://github.com/hashicorp/consul/pull/2620
# 위 PR이 머지된다면, 아래 코드를 사용하셔도 무방합니다.
#
# source = "github.com/hashicorp/consul/terraform/aws"
source = "github.com/mooyoul/consul?ref=tf-module-support-aws-seoul//terraform/aws"
key_name = "${var.key_name}"
key_path = "${var.key_path}"
region = "${var.region}"
servers = "3"
}
output "consul_address" {
value = "${module.consul.server_address}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment