Skip to content

Unable to update terraform block when added #120

@ilons

Description

@ilons

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.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions