mirror of
https://github.com/adammck/terraform-inventory
synced 2024-11-26 07:43:46 +01:00
Update examples
I unfortunately had to remove the CloudStack example, because I don't have access to one of those. Moved the old example to an integration test, at least.
This commit is contained in:
parent
c12b4cc0e5
commit
885469243c
@ -2,9 +2,6 @@ variable "do_token" {}
|
|||||||
variable "aws_access_key" {}
|
variable "aws_access_key" {}
|
||||||
variable "aws_secret_key" {}
|
variable "aws_secret_key" {}
|
||||||
variable "aws_subnet_id" {}
|
variable "aws_subnet_id" {}
|
||||||
variable "cs_api_url" {}
|
|
||||||
variable "cs_api_key" {}
|
|
||||||
variable "cs_secret_key" {}
|
|
||||||
|
|
||||||
provider "aws" {
|
provider "aws" {
|
||||||
access_key = "${var.aws_access_key}"
|
access_key = "${var.aws_access_key}"
|
||||||
@ -16,13 +13,6 @@ provider "digitalocean" {
|
|||||||
token = "${var.do_token}"
|
token = "${var.do_token}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
provider "cloudstack" {
|
|
||||||
api_url = "${var.cs_api_url}"
|
|
||||||
api_key = "${var.cs_api_key}"
|
|
||||||
secret_key = "${var.cs_secret_key}"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_instance" "web-aws" {
|
resource "aws_instance" "web-aws" {
|
||||||
ami = "ami-96a818fe"
|
ami = "ami-96a818fe"
|
||||||
instance_type = "t2.micro"
|
instance_type = "t2.micro"
|
||||||
@ -30,9 +20,30 @@ resource "aws_instance" "web-aws" {
|
|||||||
associate_public_ip_address = true
|
associate_public_ip_address = true
|
||||||
key_name = "terraform-inventory"
|
key_name = "terraform-inventory"
|
||||||
count = 2
|
count = 2
|
||||||
|
|
||||||
root_block_device = {
|
root_block_device = {
|
||||||
delete_on_termination = true
|
delete_on_termination = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Role = "Webserver"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_instance" "worker-aws" {
|
||||||
|
ami = "ami-96a818fe"
|
||||||
|
instance_type = "t2.micro"
|
||||||
|
subnet_id = "${var.aws_subnet_id}"
|
||||||
|
associate_public_ip_address = true
|
||||||
|
key_name = "terraform-inventory"
|
||||||
|
|
||||||
|
root_block_device = {
|
||||||
|
delete_on_termination = true
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Role = "Worker"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "digitalocean_droplet" "web-do" {
|
resource "digitalocean_droplet" "web-do" {
|
||||||
@ -42,10 +53,3 @@ resource "digitalocean_droplet" "web-do" {
|
|||||||
size = "512mb"
|
size = "512mb"
|
||||||
ssh_keys = [862272]
|
ssh_keys = [862272]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudstack_instance" "web-cs" {
|
|
||||||
name = "terraform-inventory-2"
|
|
||||||
service_offering = "small"
|
|
||||||
template = "centos-7-0-x64"
|
|
||||||
zone = "nyc2"
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"serial": 13,
|
"serial": 15,
|
||||||
"modules": [
|
"modules": [
|
||||||
{
|
{
|
||||||
"path": [
|
"path": [
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"aws_instance.web-aws.0": {
|
"aws_instance.web-aws.0": {
|
||||||
"type": "aws_instance",
|
"type": "aws_instance",
|
||||||
"primary": {
|
"primary": {
|
||||||
"id": "i-e8f3a238",
|
"id": "i-6db8dedb",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"ami": "ami-96a818fe",
|
"ami": "ami-96a818fe",
|
||||||
"associate_public_ip_address": "true",
|
"associate_public_ip_address": "true",
|
||||||
@ -19,13 +19,15 @@
|
|||||||
"ebs_block_device.#": "0",
|
"ebs_block_device.#": "0",
|
||||||
"ebs_optimized": "false",
|
"ebs_optimized": "false",
|
||||||
"ephemeral_block_device.#": "0",
|
"ephemeral_block_device.#": "0",
|
||||||
"id": "i-e8f3a238",
|
"iam_instance_profile": "",
|
||||||
|
"id": "i-6db8dedb",
|
||||||
"instance_type": "t2.micro",
|
"instance_type": "t2.micro",
|
||||||
"key_name": "terraform-inventory",
|
"key_name": "terraform-inventory",
|
||||||
"private_dns": "ip-10-0-0-12.ec2.internal",
|
"monitoring": "false",
|
||||||
"private_ip": "10.0.0.12",
|
"private_dns": "ip-10-0-0-14.ec2.internal",
|
||||||
|
"private_ip": "10.0.0.14",
|
||||||
"public_dns": "",
|
"public_dns": "",
|
||||||
"public_ip": "52.7.58.202",
|
"public_ip": "52.90.155.162",
|
||||||
"root_block_device.#": "1",
|
"root_block_device.#": "1",
|
||||||
"root_block_device.0.delete_on_termination": "true",
|
"root_block_device.0.delete_on_termination": "true",
|
||||||
"root_block_device.0.iops": "0",
|
"root_block_device.0.iops": "0",
|
||||||
@ -34,7 +36,8 @@
|
|||||||
"security_groups.#": "0",
|
"security_groups.#": "0",
|
||||||
"source_dest_check": "true",
|
"source_dest_check": "true",
|
||||||
"subnet_id": "subnet-59f9b32e",
|
"subnet_id": "subnet-59f9b32e",
|
||||||
"tags.#": "0",
|
"tags.#": "1",
|
||||||
|
"tags.Role": "Webserver",
|
||||||
"tenancy": "default",
|
"tenancy": "default",
|
||||||
"vpc_security_group_ids.#": "1",
|
"vpc_security_group_ids.#": "1",
|
||||||
"vpc_security_group_ids.2076429742": "sg-b42329d0"
|
"vpc_security_group_ids.2076429742": "sg-b42329d0"
|
||||||
@ -47,7 +50,7 @@
|
|||||||
"aws_instance.web-aws.1": {
|
"aws_instance.web-aws.1": {
|
||||||
"type": "aws_instance",
|
"type": "aws_instance",
|
||||||
"primary": {
|
"primary": {
|
||||||
"id": "i-f747c141",
|
"id": "i-10b9dfa6",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"ami": "ami-96a818fe",
|
"ami": "ami-96a818fe",
|
||||||
"associate_public_ip_address": "true",
|
"associate_public_ip_address": "true",
|
||||||
@ -56,14 +59,14 @@
|
|||||||
"ebs_optimized": "false",
|
"ebs_optimized": "false",
|
||||||
"ephemeral_block_device.#": "0",
|
"ephemeral_block_device.#": "0",
|
||||||
"iam_instance_profile": "",
|
"iam_instance_profile": "",
|
||||||
"id": "i-f747c141",
|
"id": "i-10b9dfa6",
|
||||||
"instance_type": "t2.micro",
|
"instance_type": "t2.micro",
|
||||||
"key_name": "terraform-inventory",
|
"key_name": "terraform-inventory",
|
||||||
"monitoring": "false",
|
"monitoring": "false",
|
||||||
"private_dns": "ip-10-0-0-10.ec2.internal",
|
"private_dns": "ip-10-0-0-6.ec2.internal",
|
||||||
"private_ip": "10.0.0.10",
|
"private_ip": "10.0.0.6",
|
||||||
"public_dns": "",
|
"public_dns": "",
|
||||||
"public_ip": "52.91.51.56",
|
"public_ip": "54.174.82.24",
|
||||||
"root_block_device.#": "1",
|
"root_block_device.#": "1",
|
||||||
"root_block_device.0.delete_on_termination": "true",
|
"root_block_device.0.delete_on_termination": "true",
|
||||||
"root_block_device.0.iops": "0",
|
"root_block_device.0.iops": "0",
|
||||||
@ -72,7 +75,47 @@
|
|||||||
"security_groups.#": "0",
|
"security_groups.#": "0",
|
||||||
"source_dest_check": "true",
|
"source_dest_check": "true",
|
||||||
"subnet_id": "subnet-59f9b32e",
|
"subnet_id": "subnet-59f9b32e",
|
||||||
"tags.#": "0",
|
"tags.#": "1",
|
||||||
|
"tags.Role": "Webserver",
|
||||||
|
"tenancy": "default",
|
||||||
|
"vpc_security_group_ids.#": "1",
|
||||||
|
"vpc_security_group_ids.2076429742": "sg-b42329d0"
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"schema_version": "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aws_instance.worker-aws": {
|
||||||
|
"type": "aws_instance",
|
||||||
|
"primary": {
|
||||||
|
"id": "i-9e85e328",
|
||||||
|
"attributes": {
|
||||||
|
"ami": "ami-96a818fe",
|
||||||
|
"associate_public_ip_address": "true",
|
||||||
|
"availability_zone": "us-east-1d",
|
||||||
|
"ebs_block_device.#": "0",
|
||||||
|
"ebs_optimized": "false",
|
||||||
|
"ephemeral_block_device.#": "0",
|
||||||
|
"iam_instance_profile": "",
|
||||||
|
"id": "i-9e85e328",
|
||||||
|
"instance_type": "t2.micro",
|
||||||
|
"key_name": "terraform-inventory",
|
||||||
|
"monitoring": "false",
|
||||||
|
"private_dns": "ip-10-0-0-5.ec2.internal",
|
||||||
|
"private_ip": "10.0.0.5",
|
||||||
|
"public_dns": "",
|
||||||
|
"public_ip": "52.23.169.41",
|
||||||
|
"root_block_device.#": "1",
|
||||||
|
"root_block_device.0.delete_on_termination": "true",
|
||||||
|
"root_block_device.0.iops": "0",
|
||||||
|
"root_block_device.0.volume_size": "8",
|
||||||
|
"root_block_device.0.volume_type": "standard",
|
||||||
|
"security_groups.#": "0",
|
||||||
|
"source_dest_check": "true",
|
||||||
|
"subnet_id": "subnet-59f9b32e",
|
||||||
|
"tags.#": "1",
|
||||||
|
"tags.Role": "Worker",
|
||||||
"tenancy": "default",
|
"tenancy": "default",
|
||||||
"vpc_security_group_ids.#": "1",
|
"vpc_security_group_ids.#": "1",
|
||||||
"vpc_security_group_ids.2076429742": "sg-b42329d0"
|
"vpc_security_group_ids.2076429742": "sg-b42329d0"
|
||||||
@ -85,11 +128,11 @@
|
|||||||
"digitalocean_droplet.web-do": {
|
"digitalocean_droplet.web-do": {
|
||||||
"type": "digitalocean_droplet",
|
"type": "digitalocean_droplet",
|
||||||
"primary": {
|
"primary": {
|
||||||
"id": "5579362",
|
"id": "9410811",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"id": "5579362",
|
"id": "9410811",
|
||||||
"image": "centos-7-0-x64",
|
"image": "centos-7-0-x64",
|
||||||
"ipv4_address": "192.241.136.44",
|
"ipv4_address": "192.241.149.172",
|
||||||
"locked": "false",
|
"locked": "false",
|
||||||
"name": "terraform-inventory-1",
|
"name": "terraform-inventory-1",
|
||||||
"region": "nyc1",
|
"region": "nyc1",
|
||||||
@ -99,20 +142,6 @@
|
|||||||
"status": "active"
|
"status": "active"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"cloudstack_instance.web-cs": {
|
|
||||||
"type": "cloudstack_instance",
|
|
||||||
"primary": {
|
|
||||||
"id": "500fb40e-8796-a724-8bcd-211bd1866bc0",
|
|
||||||
"attributes": {
|
|
||||||
"id": "500fb40e-8796-a724-8bcd-211bd1866bc0",
|
|
||||||
"ipaddress": "10.2.1.5",
|
|
||||||
"name": "terraform-inventory-2",
|
|
||||||
"service_offering": "small",
|
|
||||||
"template": "centos-7-0-x64",
|
|
||||||
"zone": "nyc2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
- hosts:
|
- hosts:
|
||||||
- web-aws
|
- web-aws
|
||||||
- web-do
|
- web-do
|
||||||
- web-cs
|
|
||||||
tasks:
|
tasks:
|
||||||
- command: "echo Hello, world!"
|
- command: "echo Hello, world!"
|
||||||
|
@ -2,6 +2,3 @@ do_token = ""
|
|||||||
aws_access_key = ""
|
aws_access_key = ""
|
||||||
aws_secret_key = ""
|
aws_secret_key = ""
|
||||||
aws_subnet_id = ""
|
aws_subnet_id = ""
|
||||||
cs_api_url = ""
|
|
||||||
cs_api_key = ""
|
|
||||||
cs_secret_key = ""
|
|
||||||
|
@ -77,7 +77,11 @@ const exampleStateFile = `
|
|||||||
"id": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
|
"id": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"id": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
|
"id": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
|
||||||
"ipaddress": "10.2.1.5"
|
"ipaddress": "10.2.1.5",
|
||||||
|
"name": "terraform-inventory-4",
|
||||||
|
"service_offering": "small",
|
||||||
|
"template": "centos-7-0-x64",
|
||||||
|
"zone": "nyc2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user