`terraform add -out` append to existing config
This commit is contained in:
parent
b9c0cbb1fd
commit
dea645797a
|
@ -74,7 +74,14 @@ func (v *addHuman) Resource(addr addrs.AbsResourceInstance, schema *configschema
|
||||||
} else {
|
} else {
|
||||||
// The Println call above adds this final newline automatically; we add it manually here.
|
// The Println call above adds this final newline automatically; we add it manually here.
|
||||||
formatted = append(formatted, '\n')
|
formatted = append(formatted, '\n')
|
||||||
return os.WriteFile(v.outPath, formatted, 0600)
|
|
||||||
|
f, err := os.OpenFile(v.outPath, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
_, err = f.Write(formatted)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue