ConfigTransformer mode filter is unused

pull/38378/head
James Bardin 1 month ago
parent 9b970d5454
commit 6aecbc1770

@ -37,10 +37,6 @@ type ConfigTransformer struct {
// Module is the module to add resources from.
Config *configs.Config
// Mode will only add resources that match the given mode
ModeFilter bool
Mode addrs.ResourceMode
// some actions are skipped during the destroy process
destroy bool
@ -159,11 +155,6 @@ func (t *ConfigTransformer) transformSingle(g *Graph, config *configs.Config) er
for _, r := range allResources {
relAddr := r.Addr()
if t.ModeFilter && relAddr.Mode != t.Mode {
// Skip non-matching modes
continue
}
// Verify that any actions referenced in the resource's ActionTriggers exist in this module
var diags tfdiags.Diagnostics
if r.Managed != nil && r.Managed.ActionTriggers != nil {

@ -36,26 +36,6 @@ func TestConfigTransformer(t *testing.T) {
}
}
func TestConfigTransformer_mode(t *testing.T) {
g := Graph{Path: addrs.RootModuleInstance}
tf := &ConfigTransformer{
Config: testModule(t, "transform-config-mode-data"),
ModeFilter: true,
Mode: addrs.DataResourceMode,
}
if err := tf.Transform(&g); err != nil {
t.Fatalf("err: %s", err)
}
actual := strings.TrimSpace(g.String())
expected := strings.TrimSpace(`
data.aws_ami.foo
`)
if actual != expected {
t.Fatalf("bad:\n\n%s", actual)
}
}
func TestConfigTransformer_nonUnique(t *testing.T) {
g := Graph{Path: addrs.RootModuleInstance}
g.Add(NewNodeAbstractResource(

Loading…
Cancel
Save