pulumi-azure-native icon indicating copy to clipboard operation
pulumi-azure-native copied to clipboard

Unable to access `access_keys` in `azure_native.cache.Redis()` when creating a redis instance

Open aureq opened this issue 3 years ago • 2 comments

What happened?

I'm running the code below to create a redis cache using the Azure Native provider.

However, I'm unable to create a stack out from the access_keys as it appears it's not set, even when creating the cache. This is a problem because keys are needed in order to access redis. And per the documentation, the access_keys property is only set during a redis create or update operation.

Also, using a refresh doesn't yield any changes.

I've also noticed as part of debugging this issue that it takes a lot of time to create a simple and small redis cache. I did set a timeout to 60m, but Pulumi returns successfully after 13m 59s, though the redis cache is still showing as creating in the Azure portal.

Steps to reproduce

  1. log in to your azure portal
  2. deploy the code below
  3. the deployment completes in ~14m
  4. the azure portal keeps showing the cache in creating state (though the deployment has correctly completed)
  5. the stack output doesn't show redis_access_key
import pulumi
import pulumi_azure_native as azure_native
from pulumi_azure_native import storage
from pulumi_azure_native import resources

redis_cache_name = "mirror-cache-dev"
redis_cache_capacity_level = 0
redis_cache_family = "C"
redis_sku_name="Basic"

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

redis_cache = azure_native.cache.Redis(
    resource_group_name=resource_group.name,
    resource_name=redis_cache_name,
    sku=azure_native.cache.SkuArgs(
        capacity=redis_cache_capacity_level,
        family=redis_cache_family,
        name=redis_sku_name,
    ),
    opts=pulumi.ResourceOptions(
        custom_timeouts=pulumi.CustomTimeouts(
            create='60m',
            update='60m',
            delete='60m'
        )
    ),
)


pulumi.export("redis_host_name", redis_cache.host_name)
pulumi.export("redis_port", redis_cache.port)
pulumi.export("redis_access_key", redis_cache.access_keys)

Expected Behavior

On a redis cache creation, the pulumi command completes when the cache becomes available (running state in the Azure portal) and the resource property access_keys is usable.

Actual Behavior

  • the property access_keys is emtpy
  • the command completes before the redis cache is in running state

Output of pulumi about

CLI          
Version      3.40.1
Go Version   go1.19
Go Compiler  gc

Plugins
NAME          VERSION
azure-native  1.79.2
python        unknown

Host     
OS       debian
Version  11.5
Arch     x86_64

This project is written in python: executable='/usr/local/bin/python3' version='3.9.13
'

Current Stack: case-1806

TYPE                                  URN
pulumi:pulumi:Stack                   urn:pulumi:case-1806::zendesk::pulumi:pulumi:Stack::zendesk-case-1806
pulumi:providers:azure-native         urn:pulumi:case-1806::zendesk::pulumi:providers:azure-native::default_1_79_2
azure-native:resources:ResourceGroup  urn:pulumi:case-1806::zendesk::azure-native:resources:ResourceGroup::resource_group
azure-native:cache:Redis              urn:pulumi:case-1806::zendesk::azure-native:cache:Redis::mirror-cache-dev


Found no pending operations associated with case-1806

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/aureq
User           aureq
Organizations  aureq, team-ce, menfin, demo, pulumi

Dependencies:
NAME                 VERSION
pip                  22.2.2
pulumi-azure-native  1.79.2
setuptools           65.4.1
wheel                0.37.1

Additional context

No response

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).

aureq avatar Oct 03 '22 02:10 aureq