sparse-intern-71089
02/26/2022, 6:45 PMgentle-account-13294
02/26/2022, 6:49 PMgentle-account-13294
02/26/2022, 7:50 PMOutput.all
seems to have worked, though would be good to discuss with experts here whether this is the correct approach.. e.g.
def snowflake_db_table_grant_future_access(database_name: Output[str], schema: Output[str], privileges: list, roles: list):
"""Grant access to a list of privileges for a schema to a list of roles ....
"""
def inner(all_outputs: Output[List[Output]]):
inner_database_name = all_outputs[0]
inner_schema = all_outputs[1]
role_hash = abs(hash(str(roles)))
for one_privilege in privileges:
snowflake.TableGrant(f"{inner_database_name}_schema_{inner_schema}_table_privilege_{one_privilege}_future_true_{role_hash}",
database_name=database_name,
privilege=one_privilege,
roles=roles,
schema_name=schema,
on_future=True
)
all_outputs = pulumi.Output.all(database_name, schema)
all_outputs.apply(inner)
when i call the above function , resources are now created with correct values for the database_name
and schema_name
.. though I guess in really they can even be thought of as CONSTANTS 🤷echoing-dinner-19531
02/26/2022, 8:13 PMi guess another way to ask my question would be, can resource names be dynamic and dependent on Output of previous resources ?Not really. You can put the whole resource inside an apply but that has problems with previews and update plans.
echoing-dinner-19531
02/26/2022, 8:15 PMgentle-account-13294
02/26/2022, 10:42 PM