python-terrascript
python-terrascript copied to clipboard
Unable to update terraform block when added
I'm trying to define my terraform resource to the configuration in multiple steps, first adding backend, and later add required_version.
I'm not certain if this is a bug or feature request, but I would expect to be able to add the resource multiple times, and have the properties merged, similar to how I can add multiple resources of other types.
My idea of how it would work is something like:
import terrascript
config = terrascript.Terrascript()
config += terrascript.terraform(backend=terrascript.backend("azurerm"))
config.add(terrascript.terraform(required_version="0.13.1"))
{'backend': {'azurerm': {}}, 'required_version': '0.13.1'}
While currently you only get the latest added resource:
import terrascript
config = terrascript.Terrascript()
config += terrascript.terraform(backend=terrascript.backend("azurerm"))
config.add(terrascript.terraform(required_version="0.13.1"))
{'terraform': {'required_version': '0.13.1'}}
What differs here is that the terraform block is a simple dict, while for example provider contains a list for each type.