cool-belgium-78445
08/16/2021, 2:57 PMclass AccountProvider(ResourceProvider):
def __init__(self, props):
self.parent_client = Client(props["sid"], props["auth_token"])
def create(self, props):
subaccount = self.parent_client.api.accounts.create(friendly_name="{}-{}".format(props["name"], stack))
return CreateResult(id_=subaccount.sid, outs={'sid':subaccount.sid, 'auth_token':subaccount.auth_token})
def delete(self, id, props):
self.parent_client.api.accounts(id).update(status="closed")
class Account(Resource):
sid: Output[str]
auth_token: Output[str]
def __init__(self, name: str, props, opts: Optional[ResourceOptions] = None):
super().__init__(AccountProvider(props), name, {"name":name, 'sid':None, 'auth_token':None}, opts)
new_account = Account("new_account1", props=AccountCredentials(sid=account_sid, auth_token=auth_token))
gentle-diamond-70147
08/16/2021, 5:19 PMnew_account = Account("new_account1", props=AccountCredentials(sid=account_sid, auth_token=auth_token))
new_account_sid = new_account.sid
Does that not work? Are you getting an error?cool-belgium-78445
08/16/2021, 5:25 PMTypeError: 'Output' object is not iterable, consider iterating the underlying value inside an 'apply'
. When I use the apply stuff from https://www.pulumi.com/docs/intro/concepts/inputs-outputs/ I also get the same errorgentle-diamond-70147
08/16/2021, 6:39 PM