json HashiCorp Terraform AWS和DOCKER正在运行
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json HashiCorp Terraform AWS和DOCKER正在运行相关的知识,希望对你有一定的参考价值。
variable "access_key" {
default = "lalalalalalalalalala"
}
variable "secret_key" {
default = "lalalalalalalalalala"
}
############ AWS ############
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
# access_key = "lalalalalalalalalala"
# secret_key = "lalalalalalalalalala"
region = "us-east-1"
}
resource "aws_instance" "example1" {
ami = "ami-d05e75b8"
instance_type = "t2.micro"
subnet_id = "subnet-XXXXX"
security_groups = ["sg-XXXXX"]
private_ip = "10.0.0.10"
tags {
Name = "example1"
Description = "Ubuntu Server 14.04 LTS (HVM), SSD Volume Type"
SO = "Ubuntu"
Usage = "testing"
Unit = "1"
}
}
output "example1_ip" {
value = "${aws_instance.example1.public_ip}"
}
# to retrieve output information...
# $ terraform output example1_ip
############ DOCKER ############
# example command...
# $ docker run
# --name some-nginx
# -v /vagrant:/usr/share/nginx/html:ro
# -p 8080:80
# -d nginx
resource "docker_image" "nginx" {
name = "nginx:latest"
}
resource "docker_container" "example4" {
image = "${docker_image.nginx.latest}"
name = "example4"
hostname = "some-nginx"
volumes {
container_path = "/usr/share/nginx/html"
host_path = "/vagrant"
read_only = "true"
}
ports {
internal = 80
external = 8080
}
}
以上是关于json HashiCorp Terraform AWS和DOCKER正在运行的主要内容,如果未能解决你的问题,请参考以下文章
如何在 Hashicorp Terraform 中配置环境变量
译微软出品HashiCorp Terraform 和 Vault 系列视频
微软出品HashiCorp Terraform 和 Vault 系列视频
京东云携手HashiCorp,宣布推出Terraform Provider
GMO Media 使用 HashiCorp Terraform Enterprise 自动配置基础
Terraform 应用服务不会连接到存储帐户