config: understand provisioner blocks in JSON [GH-807]
This commit is contained in:
parent
58649132cf
commit
91a3405e88
|
@ -16,6 +16,7 @@ BUG FIXES:
|
||||||
* core: Escape characters `\"`, `\n`, and `\\` now work in interpolations.
|
* core: Escape characters `\"`, `\n`, and `\\` now work in interpolations.
|
||||||
* core: Fix crash that could occur when there are exactly zero providers
|
* core: Fix crash that could occur when there are exactly zero providers
|
||||||
installed on a system. [GH-786]
|
installed on a system. [GH-786]
|
||||||
|
* core: JSON TF configurations can configure provisioners. [GH-807]
|
||||||
* provider/aws: ELB subnet change doesn't force new resource. [GH-804]
|
* provider/aws: ELB subnet change doesn't force new resource. [GH-804]
|
||||||
|
|
||||||
PLUGIN CHANGES:
|
PLUGIN CHANGES:
|
||||||
|
|
|
@ -517,9 +517,17 @@ func loadProvisionersHcl(os *hclobj.Object, connInfo map[string]interface{}) ([]
|
||||||
//
|
//
|
||||||
for _, o1 := range os.Elem(false) {
|
for _, o1 := range os.Elem(false) {
|
||||||
for _, o2 := range o1.Elem(true) {
|
for _, o2 := range o1.Elem(true) {
|
||||||
|
|
||||||
|
switch o1.Type {
|
||||||
|
case hclobj.ValueTypeList:
|
||||||
|
for _, o3 := range o2.Elem(true) {
|
||||||
|
pos = append(pos, o3)
|
||||||
|
}
|
||||||
|
case hclobj.ValueTypeObject:
|
||||||
pos = append(pos, o2)
|
pos = append(pos, o2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Short-circuit if there are no items
|
// Short-circuit if there are no items
|
||||||
if len(pos) == 0 {
|
if len(pos) == 0 {
|
||||||
|
|
|
@ -410,6 +410,10 @@ const basicResourcesStr = `
|
||||||
aws_instance[db] (x1)
|
aws_instance[db] (x1)
|
||||||
VPC
|
VPC
|
||||||
security_groups
|
security_groups
|
||||||
|
provisioners
|
||||||
|
file
|
||||||
|
destination
|
||||||
|
source
|
||||||
dependsOn
|
dependsOn
|
||||||
aws_instance.web
|
aws_instance.web
|
||||||
vars
|
vars
|
||||||
|
@ -418,6 +422,10 @@ aws_instance[web] (x1)
|
||||||
ami
|
ami
|
||||||
network_interface
|
network_interface
|
||||||
security_groups
|
security_groups
|
||||||
|
provisioners
|
||||||
|
file
|
||||||
|
destination
|
||||||
|
source
|
||||||
vars
|
vars
|
||||||
resource: aws_security_group.firewall.foo
|
resource: aws_security_group.firewall.foo
|
||||||
user: var.foo
|
user: var.foo
|
||||||
|
|
|
@ -27,6 +27,11 @@ resource aws_instance "web" {
|
||||||
device_index = 0
|
device_index = 0
|
||||||
description = "Main network interface"
|
description = "Main network interface"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = "foo"
|
||||||
|
destination = "bar"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_instance" "db" {
|
resource "aws_instance" "db" {
|
||||||
|
@ -34,6 +39,11 @@ resource "aws_instance" "db" {
|
||||||
VPC = "foo"
|
VPC = "foo"
|
||||||
|
|
||||||
depends_on = ["aws_instance.web"]
|
depends_on = ["aws_instance.web"]
|
||||||
|
|
||||||
|
provisioner "file" {
|
||||||
|
source = "foo"
|
||||||
|
destination = "bar"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output "web_ip" {
|
output "web_ip" {
|
||||||
|
|
|
@ -22,7 +22,14 @@
|
||||||
"db": {
|
"db": {
|
||||||
"security_groups": ["${aws_security_group.firewall.*.id}"],
|
"security_groups": ["${aws_security_group.firewall.*.id}"],
|
||||||
"VPC": "foo",
|
"VPC": "foo",
|
||||||
"depends_on": ["aws_instance.web"]
|
"depends_on": ["aws_instance.web"],
|
||||||
|
|
||||||
|
"provisioner": [{
|
||||||
|
"file": {
|
||||||
|
"source": "foo",
|
||||||
|
"destination": "bar"
|
||||||
|
}
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
|
|
||||||
"web": {
|
"web": {
|
||||||
|
@ -34,6 +41,13 @@
|
||||||
"network_interface": {
|
"network_interface": {
|
||||||
"device_index": 0,
|
"device_index": 0,
|
||||||
"description": "Main network interface"
|
"description": "Main network interface"
|
||||||
|
},
|
||||||
|
|
||||||
|
"provisioner": {
|
||||||
|
"file": {
|
||||||
|
"source": "foo",
|
||||||
|
"destination": "bar"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue