https://pulumi.com logo
#general
Title
# general
l

lemon-dog-29241

08/13/2021, 5:00 PM
Hey everyone! I am trying to use StackReferences in conjunction with saving my state in S3 buckets in AWS. I have a stack in the bucket: 
<s3://pulumi-state-1234567899875/shared>
 with a fully qualified name: 
kiawnna/buildbot-shared-123456789/dev
 and a stack in the bucket: 
<s3://pulumi-state-1234567899875/builds/{build_id}/{repo_name}>
  named 
kiawnna/buildbot-12345-{repo}/dev
. I'm getting the below error(s) from the StackReferences I have.
Copy code
Diagnostics:
pulumi:pulumi:Stack (buildbot-12345-python-backend-dev):
error: update failed

pulumi:pulumi:StackReference (kiawnna/buildbot-shared-123456789/dev):
error: unknown stack "kiawnna/buildbot-shared-123456789/dev"

Resources:
5 unchanged

Duration: 4s

Traceback (most recent call last):
  File "containerized_build.py", line 320, in <module>
    launch_app_stack()
  File "containerized_build.py", line 317, in launch_app_stack
Task exception was never retrieved
future: <Task finished name='Task-34' coro=<RPCManager.do_rpc.<locals>.rpc_wrapper() done, defined at /home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/runtime/rpc_manager.py:61> exception=<_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses"
        debug_error_string = "{"created":"@1628855755.981741273","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3008,"referenced_errors":[{"created":"@1628855755.981738026","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":397,"grpc_status":14}]}"
>>
Traceback (most recent call last):
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/runtime/rpc_manager.py", line 67, in rpc_wrapper
    result = await rpc
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/runtime/resource.py", line 397, in do_read
    log.debug(f"resource read successful: ty={ty}, urn={resp.urn}")
AttributeError: 'NoneType' object has no attribute 'urn'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/runtime/rpc_manager.py", line 70, in rpc_wrapper
    log.debug("RPC failed with exception:")
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/log.py", line 40, in debug
    _log(engine, engine_pb2.DEBUG, msg, resource, stream_id, ephemeral)
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/log.py", line 114, in _log
    engine.Log(req)
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses"
        debug_error_string = "{"created":"@1628855755.981741273","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3008,"referenced_errors":[{"created":"@1628855755.981738026","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":397,"grpc_status":14}]}"
>
    up_res = stack.up(on_output=print)
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/automation/_stack.py", line 262, in up
    up_result = self._run_pulumi_cmd_sync(args, on_output)
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/automation/_stack.py", line 591, in _run_pulumi_cmd_sync
    result = _run_pulumi_cmd(args, self.workspace.work_dir, envs, on_output)
  File "/home/kia/projects/sindri/venv/lib/python3.8/site-packages/pulumi/automation/_cmd.py", line 75, in _run_pulumi_cmd
    raise create_command_error(result)
pulumi.automation.errors.CommandError:
 code: 255
 stdout: Updating (dev):

pulumi:pulumi:Stack buildbot-12345-python-backend-dev running
aws:ecs:TaskDefinition 12345-python-backend-qa  [diff: +__defaults]
aws:cloudwatch:LogGroup 12345-python-backend-qa  [diff: ~tags]
aws:codebuild:Project 12345-python-backend-qa-1  [diff: ~environment,source,tags]
pulumi:pulumi:Stack buildbot-12345-python-backend-dev running read pulumi:pulumi:StackReference kiawnna/buildbot-shared-123456789/dev
aws:codebuild:Project 12345-python-backend-qa-0  [diff: ~environment,source,tags]
pulumi:pulumi:StackReference kiawnna/buildbot-shared-123456789/dev  error: unknown stack "kiawnna/buildbot-shared-123456789/dev"
pulumi:pulumi:Stack buildbot-12345-python-backend-dev running read pulumi:pulumi:StackReference kiawnna/buildbot-shared-123456789/dev
pulumi:pulumi:Stack buildbot-12345-python-backend-dev running error: update failed
pulumi:pulumi:StackReference kiawnna/buildbot-shared-123456789/dev **failed** 1 error
pulumi:pulumi:Stack buildbot-12345-python-backend-dev **failed** 1 error

Diagnostics:
pulumi:pulumi:Stack (buildbot-12345-python-backend-dev):
error: update failed

pulumi:pulumi:StackReference (kiawnna/buildbot-shared-123456789/dev):
error: unknown stack "kiawnna/buildbot-shared-123456789/dev"

Resources:
5 unchanged

Duration: 4s
In the stack that depends on the shared stack, I'm doing:
Copy code
shared_stack = StackReference(f"kiawnna/buildbot-shared-123456789/dev")
cluster_name = shared_stack.get_output("cluster_name")
vpc_id = shared_stack.get_output("vpc_id")
capacity_provider_name = shared_stack.get_output("capacity_provider_name")
Is what I want to do possible? How would I set it up differently? THanks!
s

steep-toddler-94095

08/13/2021, 5:18 PM
you said in your message you have a stack named
kiawnna/shared-123456789/dev
but in the error message it's saying unknown stack for
kiawnna/buildbot-shared-123456789/dev
. Is there a typo in you rmessage?
l

lemon-dog-29241

08/13/2021, 5:50 PM
@steep-toddler-94095 yes! I had a typo in my message.
b

bored-oyster-3147

08/13/2021, 6:06 PM
FYI you cannot use StackReferences to what are essentially separate backends. You can only reference stacks/projects that reside in the same backend.
l

lemon-dog-29241

08/13/2021, 6:57 PM
Thank you @bored-oyster-3147! That's all I needed to know 🙂
26 Views