mirror of https://github.com/hashicorp/terraform
command/show: add "module_version" to "module_calls" in config (#20367)
* command/show: add "module_version" to "module_calls" in config portion of `terraform show`. Also extended the `terraform show -json` test to run `init` so we could add examples with modules. This does _not_ test the "module_version" yet, but it _did_ help expose a bug in jsonplan where modules were duplicated. This is also fixed in this PR. * command/jsonconfig: rename version to version_constraint and resolved_source to source.pull/20385/head
parent
0ff04b1232
commit
818b4ec068
@ -0,0 +1,11 @@
|
||||
variable "test_var" {
|
||||
default = "bar"
|
||||
}
|
||||
resource "test_instance" "test" {
|
||||
ami = var.test_var
|
||||
count = 3
|
||||
}
|
||||
|
||||
output "test" {
|
||||
value = var.test_var
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
module "test" {
|
||||
source = "./foo"
|
||||
test_var = "baz"
|
||||
}
|
||||
|
||||
output "test" {
|
||||
value = module.test.test
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
{"Modules":[{"Key":"","Source":"","Dir":"/Users/kristin/go/src/github.com/hashicorp/terraform/command/test-fixtures/show-json/modules"},{"Key":"test","Source":"./foo","Dir":"/Users/kristin/go/src/github.com/hashicorp/terraform/command/test-fixtures/show-json/modules/foo"}]}
|
||||
@ -0,0 +1,193 @@
|
||||
{
|
||||
"format_version": "0.1",
|
||||
"planned_values": {
|
||||
"outputs": {
|
||||
"test": {
|
||||
"sensitive": false,
|
||||
"value": "baz"
|
||||
}
|
||||
},
|
||||
"root_module": {
|
||||
"child_modules": [
|
||||
{
|
||||
"resources": [
|
||||
{
|
||||
"address": "module.test.test_instance.test[0]",
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"index": 0,
|
||||
"provider_name": "test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "baz"
|
||||
}
|
||||
},
|
||||
{
|
||||
"address": "module.test.test_instance.test[1]",
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"index": 1,
|
||||
"provider_name": "test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "baz"
|
||||
}
|
||||
},
|
||||
{
|
||||
"address": "module.test.test_instance.test[2]",
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"index": 2,
|
||||
"provider_name": "test",
|
||||
"schema_version": 0,
|
||||
"values": {
|
||||
"ami": "baz"
|
||||
}
|
||||
}
|
||||
],
|
||||
"address": "module.test"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"resource_changes": [
|
||||
{
|
||||
"address": "module.test.test_instance.test[0]",
|
||||
"module_address": "module.test",
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"index": 0,
|
||||
"deposed": true,
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
],
|
||||
"before": null,
|
||||
"after": {
|
||||
"ami": "baz"
|
||||
},
|
||||
"after_unknown": {
|
||||
"ami": false,
|
||||
"id": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"address": "module.test.test_instance.test[1]",
|
||||
"module_address": "module.test",
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"index": 1,
|
||||
"deposed": true,
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
],
|
||||
"before": null,
|
||||
"after": {
|
||||
"ami": "baz"
|
||||
},
|
||||
"after_unknown": {
|
||||
"ami": false,
|
||||
"id": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"address": "module.test.test_instance.test[2]",
|
||||
"module_address": "module.test",
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"index": 2,
|
||||
"deposed": true,
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
],
|
||||
"before": null,
|
||||
"after": {
|
||||
"ami": "baz"
|
||||
},
|
||||
"after_unknown": {
|
||||
"ami": false,
|
||||
"id": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"output_changes": {
|
||||
"test": {
|
||||
"actions": [
|
||||
"create"
|
||||
],
|
||||
"before": null,
|
||||
"after": "baz",
|
||||
"after_unknown": false
|
||||
}
|
||||
},
|
||||
"configuration": {
|
||||
"root_module": {
|
||||
"outputs": {
|
||||
"test": {
|
||||
"expression": {
|
||||
"references": [
|
||||
"module.test.test"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"module_calls": {
|
||||
"test": {
|
||||
"source": "./foo",
|
||||
"expressions": {
|
||||
"test_var": {
|
||||
"constant_value": "baz"
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"outputs": {
|
||||
"test": {
|
||||
"expression": {
|
||||
"references": [
|
||||
"var.test_var"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"address": "test_instance.test",
|
||||
"mode": "managed",
|
||||
"type": "test_instance",
|
||||
"name": "test",
|
||||
"provider_config_key": "provider.test",
|
||||
"expressions": {
|
||||
"ami": {
|
||||
"references": [
|
||||
"var.test_var"
|
||||
]
|
||||
}
|
||||
},
|
||||
"schema_version": 0,
|
||||
"count_expression": {
|
||||
"constant_value": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"test_var": {
|
||||
"default": "bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue