-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Labels
Milestone
Description
In our Terrascript 0.6.1 scripts, we have a bunch of functions that define pieces of the configuration, and we assemble them like this:
ts = terrascript.Terrascript()
ts += terrascript.terraform(
backend = terrascript.backend(
"s3",
**config['backend']['s3']
)
)
ts.update(tsumami.provider.define(config))
ts.update(tsumami.s3.define(config))
ts.update(tsumami.security_groups.define(config))
where config is a dict based on a collection of YAML config files.
Each of those functions looks like this:
def define(config):
my_ts = terrascript.Terrascript()
if 's3-bucket' in config:
for (resource, data) in config['s3-bucket'].items():
# code that does various things
my_ts += terrascript.resource.aws.aws_s3_bucket(
resource,
bucket = bucketname,
**data
)
return(my_ts)
That used to work in 0.6.1, but doesn't in 0.8.0; it seems that each ts.update(something) replaces the previous one, and only the last one ends up in the config when we write out str(ts) at the end.
What's the right way to do this in 0.8.0?