terraform: add test for filtering nested modules

This commit is contained in:
Mitchell Hashimoto 2016-08-17 18:54:18 -05:00
parent 181b4b188b
commit 05cbb5c0ea
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 61 additions and 0 deletions

View File

@ -92,6 +92,20 @@ func TestStateFilterFilter(t *testing.T) {
"*terraform.InstanceState: module.consul.aws_instance.consul-green[0]",
},
},
"nested modules": {
"nested-modules.tfstate",
[]string{"module.outer"},
[]string{
"*terraform.ModuleState: module.outer",
"*terraform.ModuleState: module.outer.module.child1",
"*terraform.ResourceState: module.outer.module.child1.aws_instance.foo",
"*terraform.InstanceState: module.outer.module.child1.aws_instance.foo",
"*terraform.ModuleState: module.outer.module.child2",
"*terraform.ResourceState: module.outer.module.child2.aws_instance.foo",
"*terraform.InstanceState: module.outer.module.child2.aws_instance.foo",
},
},
}
for n, tc := range cases {

View File

@ -0,0 +1,47 @@
{
"version": 1,
"serial": 12,
"modules": [
{
"path": [
"root",
"outer"
],
"resources": {}
},
{
"path": [
"root",
"outer",
"child1"
],
"resources": {
"aws_instance.foo": {
"type": "aws_instance",
"depends_on": [],
"primary": {
"id": "1",
"attributes": {}
}
}
}
},
{
"path": [
"root",
"outer",
"child2"
],
"resources": {
"aws_instance.foo": {
"type": "aws_instance",
"depends_on": [],
"primary": {
"id": "1",
"attributes": {}
}
}
}
}
]
}