Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage account NetworkRuleSetResponseArgs has no attribute #2061

Closed
tusharshahrs opened this issue Oct 31, 2022 · 3 comments
Closed

storage account NetworkRuleSetResponseArgs has no attribute #2061

tusharshahrs opened this issue Oct 31, 2022 · 3 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue

Comments

@tusharshahrs
Copy link

What happened?

When using

network_rule_set= storage.NetworkRuleSetResponseArgs( 

in storageaccount
we get the following error:

AttributeError: module 'pulumi_azure_native.storage' has no attribute 'NetworkRuleSetResponseArgs'

Steps to reproduce

requirements.txt contains


The __main__.py contains

"""An Azure RM Python Pulumi program"""

import pulumi
from pulumi_azure_native import storage
from pulumi_azure_native import resources

# Create an Azure Resource Group
resource_group = resources.ResourceGroup('resource_group')

# Create an Azure resource (Storage Account)
account = storage.StorageAccount('sa',
    resource_group_name=resource_group.name,
   network_rule_set= storage.NetworkRuleSetResponseArgs(  # <--- this is the line that causes the error
   #network_rule_set= storage.NetworkRuleSetArgs( # This line that is the work around
        default_action= storage.DefaultAction.DENY
    ),
    sku=storage.SkuArgs(
        name=storage.SkuName.STANDARD_LRS,
    ),
    kind=storage.Kind.STORAGE_V2)

# Export the primary key of the Storage Account
primary_key = pulumi.Output.all(resource_group.name, account.name) \
    .apply(lambda args: storage.list_storage_account_keys(
        resource_group_name=args[0],
        account_name=args[1]
    )).apply(lambda accountKeys: accountKeys.keys[0].value)

pulumi.export("primary_storage_key", pulumi.Output.secret(primary_key))

Expected Behavior

Expect the storage account to be created.

Actual Behavior

This happens on pulumi up

View Live: https://app.pulumi.com/shaht/azure-py-storage-account-networkrulesetresponseargs/dev/previews/86e05476-a668-4727-bdef-70f6a48fab0d

     Type                                     Name                                                 
 +   pulumi:pulumi:Stack                      azure-py-storage-account-networkrulesetresponseargs-d
 +   └─ azure-native:resources:ResourceGroup  resource_group                                   
 
Diagnostics:
  pulumi:pulumi:Stack (azure-py-storage-account-networkrulesetresponseargs-dev):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/.../azure-py-storage-account-networkrulesetresponseargs/./__main__.py", line 13, in <module>
        network_rule_set= storage.NetworkRuleSetResponseArgs(  # <--- this is the line that causes the error
    AttributeError: module 'pulumi_azure_native.storage' has no attribute 'NetworkRuleSetResponseArgs'

Output of pulumi about

CLI
Version 3.45.0
Go Version go1.19.2
Go Compiler gc

Plugins
NAME VERSION
azure-native 1.84.0
python unknown

Host
OS darwin
Version 11.6.8
Arch x86_64

This project is written in python: executable='/Users/tusharshah/projects/pulumi-home/azure-py-storage-account-networkrulesetresponseargs/venv/bin/python3' version='3.10.8
'

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend
Name pulumi.com
URL https://app.pulumi.com/shaht
User shaht
Organizations shaht

Dependencies:
NAME VERSION
pip 22.3.0
pulumi-azure-native 1.84.0
setuptools 65.5.0
wheel 0.37.1

Additional context

Additional context
The workaround is to do the following with the storage account resource
Uncomment the NetworkRuleSetArgs and comment out: NetworkRuleSetResponseArgs so that the two lines show the following:

#properties=storage.NetworkRuleSetResponseArgs(
properties=storage.NetworkRuleSetArgs(

The code will work fine.

The documentation in storageaccount for create a nfsv3accountcreate shows to use:
storage.NetworkRuleSetResponseArgs

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@tusharshahrs tusharshahrs added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 31, 2022
@tusharshahrs tusharshahrs changed the title storage account docs incorrectly use NetworkRuleSetResponseArgs instead of NetworkRuleSetArgs storage account NetworkRuleSetResponseArgs has no attribute Oct 31, 2022
@viveklak
Copy link
Contributor

viveklak commented Nov 1, 2022

This looks like a program gen bug? In this case the resource azure-native:storage:StorageAccount has the following for the properties:

                "networkRuleSet": {
                    "type": "object",
                    "$ref": "#/types/azure-native:storage:NetworkRuleSetResponse",
                    "description": "Network rule set"
                },

while it contains the following for input properties:

                "networkRuleSet": {
                    "type": "object",
                    "$ref": "#/types/azure-native:storage:NetworkRuleSet",
                    "description": "Network rule set"
                },

Perhaps python programgen is somehow confusing properties with inputProperties in lowering the object constructor from PCL?

@viveklak
Copy link
Contributor

viveklak commented Nov 1, 2022

Opened pulumi/pulumi#11219 to track the underlying issue.

@viveklak viveklak added awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). and removed needs-triage Needs attention from the triage team labels Nov 1, 2022
@mikhailshilkov mikhailshilkov added the resolution/duplicate This issue is a duplicate of another issue label Feb 7, 2023
@mikhailshilkov
Copy link
Member

mikhailshilkov commented Feb 7, 2023

I'll close it as a dupe of #11219, it can't be fixed on the Azure Native provider

@mikhailshilkov mikhailshilkov closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants