Hi guys, my name is Ivan Indjic and I am working a...
# python
f
Hi guys, my name is Ivan Indjic and I am working as a DevOps engineer in a Serbian based company. I'm learning Pulumi both for work and for my master thesis. I have one problem with my current stack. I created one rds instance and I want to use output of that resource ( rds address ) as an env var in my ecs container definition. So, I have this instance below.
Copy code
database = aws.rds.Instance(
    resource_name="master-thesis-rds",
    allocated_storage = 5,
    instance_class='db.t4g.micro',
    allow_major_version_upgrade=False,
    apply_immediately=False,
    auto_minor_version_upgrade=True,
    db_name='master',
    db_subnet_group_name='db-subnet-group',
    deletion_protection=False,
    enabled_cloudwatch_logs_exports=['audit', 'error', 'general', 'slowquery'],
    engine='mysql',
    performance_insights_enabled=True,
    port=5432,
    publicly_accessible=False,
    skip_final_snapshot=True,
    vpc_security_group_ids=[db_sg.id],
    username='',
    password=password.value
)
Then, I did this:
Copy code
rds_endpoint = database.address.apply(lambda address: f"http://{address}")
And last, I have ecs container definition with these env vars:
Copy code
"environment": [
                {
                    "name": "user", "value": ""
                },
                {
                    "name": "password", "value": f"{password.value}"
                },
                {
                    "name": "db_host_replica", "value": rds_endpoint
                },
                {
                    "name": "db_host", "value": rds_endpoint
                }
            ],
However, when I run this, I get
Copy code
TypeError: Object of type Output is not JSON serializable
Do you guys know where is a mistake? I tried different ways but I cannot get right output converted to string. Thank you
b
f
Thank you man, saved me a lot of time