mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
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]",
|
"*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 {
|
for n, tc := range cases {
|
||||||
|
47
terraform/test-fixtures/state-filter/nested-modules.tfstate
Normal file
47
terraform/test-fixtures/state-filter/nested-modules.tfstate
Normal 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": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user