terraform: add test for filtering nested modules
This commit is contained in:
parent
181b4b188b
commit
05cbb5c0ea
|
@ -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 {
|
||||
|
|
|
@ -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": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue