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: Fix crash that could occur when there are exactly zero providers
|
||||
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]
|
||||
|
||||
PLUGIN CHANGES:
|
||||
|
|
|
@ -517,9 +517,17 @@ func loadProvisionersHcl(os *hclobj.Object, connInfo map[string]interface{}) ([]
|
|||
//
|
||||
for _, o1 := range os.Elem(false) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Short-circuit if there are no items
|
||||
if len(pos) == 0 {
|
||||
|
|
|
@ -410,6 +410,10 @@ const basicResourcesStr = `
|
|||
aws_instance[db] (x1)
|
||||
VPC
|
||||
security_groups
|
||||
provisioners
|
||||
file
|
||||
destination
|
||||
source
|
||||
dependsOn
|
||||
aws_instance.web
|
||||
vars
|
||||
|
@ -418,6 +422,10 @@ aws_instance[web] (x1)
|
|||
ami
|
||||
network_interface
|
||||
security_groups
|
||||
provisioners
|
||||
file
|
||||
destination
|
||||
source
|
||||
vars
|
||||
resource: aws_security_group.firewall.foo
|
||||
user: var.foo
|
||||
|
|
|
@ -27,6 +27,11 @@ resource aws_instance "web" {
|
|||
device_index = 0
|
||||
description = "Main network interface"
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
source = "foo"
|
||||
destination = "bar"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_instance" "db" {
|
||||
|
@ -34,6 +39,11 @@ resource "aws_instance" "db" {
|
|||
VPC = "foo"
|
||||
|
||||
depends_on = ["aws_instance.web"]
|
||||
|
||||
provisioner "file" {
|
||||
source = "foo"
|
||||
destination = "bar"
|
||||
}
|
||||
}
|
||||
|
||||
output "web_ip" {
|
||||
|
|
|
@ -22,7 +22,14 @@
|
|||
"db": {
|
||||
"security_groups": ["${aws_security_group.firewall.*.id}"],
|
||||
"VPC": "foo",
|
||||
"depends_on": ["aws_instance.web"]
|
||||
"depends_on": ["aws_instance.web"],
|
||||
|
||||
"provisioner": [{
|
||||
"file": {
|
||||
"source": "foo",
|
||||
"destination": "bar"
|
||||
}
|
||||
}]
|
||||
},
|
||||
|
||||
"web": {
|
||||
|
@ -34,6 +41,13 @@
|
|||
"network_interface": {
|
||||
"device_index": 0,
|
||||
"description": "Main network interface"
|
||||
},
|
||||
|
||||
"provisioner": {
|
||||
"file": {
|
||||
"source": "foo",
|
||||
"destination": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue