This message was deleted.
# azure
s
This message was deleted.
1
h
currently working around this like so:
Copy code
STORAGE_ACCOUNT_NAME = f'{PREFIX_CLEAN}storage'[:24]

storage_account = az.storage.StorageAccount(
        resource_name='storageAccount',
        resource_group_name=rg.name,
        account_name=STORAGE_ACCOUNT_NAME,  # HACK 1
        kind=az.storage.Kind.STORAGE_V2,
        sku=az.storage.SkuArgs(
                name=az.storage.SkuName.STANDARD_LRS,
        ),
)

file_share = az.storage.FileShare(
        resource_name='fileShare',
        resource_group_name=rg.name,
        # Unable to extract storage_account.account_name:
        account_name=STORAGE_ACCOUNT_NAME,  # HACK 2
        share_name=f'{PREFIX_CLEAN}-share'[:63],
        access_tier=az.storage.ShareAccessTier.TRANSACTION_OPTIMIZED,
        share_quota=5120,
        opts=p.ResourceOptions(
                # Workaround for missing storage_account.account_name:
                depends_on=[
                    storage_account,  # HACK 3
                ],
                parent=storage_account,
        ),
)
is this a bug or am i missing something?
g
you should be able to do
account_name=storage_account.name
in your
FileShare
🙌 1
h
thanks! while that worked for me (it didn't before for some reason), isn't it a bit counter-intuitive?
.name
usually maps to the referred resource's
resource_name
, right? and every other property has a getter by the same name except this. just trying to understand if there's a pattern that i'm missing here
t
FWIW, that’s how Azure API is modelled. They always have an output property called
name
. We build that
name
from
resource_name
if the specific input property like
account_name
is not specified, or from
account_name
if it is.
👍 1