# general


10/09/2019, 5:55 PM
with shared
passed down to the child resources seems to mutate the options - which leads to confusing error messages of duplicate resource aliases. Do I need to construct a new options object for each child resource?
My idea was to encapsulate some kubernetes deployments inside a
, constructing the options in the ComponentResource constructor and passing the same instance to all children. Doing so resulted in an error of duplicate aliases for several URNs. When constructing them for each this doesn’t happen.
Copy code
error: Duplicate resource alias 'urn:pulumi:dev::xxxxx::ajaegle:xxxxx:fullservicedeployment$kubernetes:apps/v1:Deployment::whoami' applied to resource with URN 'urn:pulumi:dev::xxxxx::ajaegle:xxxxx:fullservicedeployment$kubernetes:apps/v1:Deployment::processor-deploy' conflicting with resource with URN 'urn:pulumi:dev::xxxxx::ajaegle:xxxxx:fullservicedeployment$kubernetes:core/v1:Service::processor-svc'
This happened when I created a
(using deconstruction) in the
constructor and passing it as third argument like
. Works when using
{parent: this, provider: this.args.k8sProvider}
. Is there some mutation on the object? I’m using kubernetes deployments and services as child resources.


10/09/2019, 7:40 PM
In principal we should not be mutating these, but it is possible there is a bug somewhere that this is triggering. Could you open an issue, ideally with a smallish repro?


10/10/2019, 9:44 AM
I just set up a minimal repository that should cause the same issues and cannot find them. So I reverted the code in my real project to the version containing these shared options and now also there - no more complaints. The difference here is that I’m doing it from zero to full instead of the half/half case before. Could this be the root cause of the issue (maybe some diff method that causes this)? Seems pretty hard to reproduce now.
I assumed that it could be caused by first creating only one deployment and in a next run creating the second deployment which would cause a diff to be run (possibly triggering these problems). So I ran it with just one deployment and one service and when performing the update (not just preview) it failed with just the deployment and the service. I try if this happens reliably and if so, provide a repro repository.
Error after
pulumi up
and applying the changes:
Copy code
panic: fatal: An assertion has failed: Two resources ('urn:pulumi:dev::pulumi-component-resource-mutability-issue::ajaegle:componentres:mutabilityissue$kubernetes:apps/v1:Deployment::whoami-one' and 'urn:pulumi:dev::pulumi-component-resource-mutability-issue::ajaegle:componentres:mutabilityissue$kubernetes:core/v1:Service::whoami') aliased to the same: 'urn:pulumi:dev::pulumi-component-resource-mutability-issue::ajaegle:componentres:mutabilityissue$kubernetes:apps/v1:Deployment::whoami-one'

goroutine 297 [running]:
<|>, 0x22f3765, 0x37, 0xc00174bce0, 0x3, 0x3)
	/private/tmp/pulumi-20191001-29115-1u0fjxm/src/ +0x198
	/private/tmp/pulumi-20191001-29115-1u0fjxm/src/ +0x6cb
<*SnapshotManager).saveSnapshot(0xc001134480|*SnapshotManager).saveSnapshot(0xc001134480>, 0xc00174bf30, 0x2)
	/private/tmp/pulumi-20191001-29115-1u0fjxm/src/ +0x42
<|>, 0xc001134480, 0xc001084420, 0xc001084480)
	/private/tmp/pulumi-20191001-29115-1u0fjxm/src/ +0x12e
created by <|>
	/private/tmp/pulumi-20191001-29115-1u0fjxm/src/ +0x150