I'm using Troposphere to build CloudFormation stacks and would like to pass the Elastic Load Balancer
ConnectionSettings
None
troposphere.elasticloadbalancing.ConnectionSettings
lb = template.add_resource(elb.LoadBalancer(
...
))
if condition:
lb.add_attribute(ConnectionSettings = elb.ConnectionSettings(
...
))
Troposphere
if condition:
lb.__setattr__('ConnectionSettings', elb.ConnectionSettings(
....
))
The main README eludes to just using the attribute names like this:
from troposphere import Template
import troposphere.elasticloadbalancing as elb
template = Template()
webelb = elb.LoadBalancer(
'ElasticLoadBalancer',
Listeners=[
elb.Listener(
LoadBalancerPort="80",
InstancePort="80",
Protocol="HTTP",
),
],
)
if True:
webelb.ConnectionSettings = elb.ConnectionSettings(IdleTimeout=30)
elasticLB = template.add_resource(webelb)
print(template.to_json())