```Updating (test-stack): pulumi:pulumi:Sta...
# general
l
Copy code
Updating (test-stack):



    pulumi:pulumi:Stack test-project-test-stack running 

 ~  alicloud:fc:Service qianfeng-pulumi-component-test updating [diff: ~description]

 ~  alicloud:fc:Service qianfeng-pulumi-component-test updated [diff: ~description]

    alicloud:fc:Function my-function-1  

 ~  alicloud:fc:Service qianfeng-pulumi-component-test **updating failed** [diff: ~description]; error: Cannot delete parent resource 'urn:pulumi:test-stack::test-project::alicloud:fc/service:Service::qianfeng-pulumi-component-test' without also deleting child 'urn:pulumi:test-stack::test-project::alicloud:fc/service:Service$alicloud:fc/function:Function::my-function-1'.

    pulumi:pulumi:Stack test-project-test-stack  
 

Diagnostics:
  alicloud:fc:Service (qianfeng-pulumi-component-test):
    error: Cannot delete parent resource 'urn:pulumi:test-stack::test-project::alicloud:fc/service:Service::qianfeng-pulumi-component-test' without also deleting child 'urn:pulumi:test-stack::test-project::alicloud:fc/service:Service$alicloud:fc/function:Function::my-function-1'.
 
Outputs:
    functionUrn: "urn:pulumi:test-stack::test-project::alicloud:fc/service:Service$alicloud:fc/function:Function::my-function-1"
    serviceUrn : "urn:pulumi:test-stack::test-project::alicloud:fc/service:Service::qianfeng-pulumi-component-test"

Resources:
    ~ 1 updated
    2 unchanged
The problem was caused by ‘pulumi up --target xxx’ command and I just want to update the description of my alicloud function computer service. But pulumi told me that I can not delete the resource with the existed child resource, which confused me!
Please help me!!!
@clever-sunset-76585
c
@little-van-8457 it is hard to know what is going on without seeing the code as well. Are you able to share the relevant parts of your code?
l
Copy code
import * as alicloud from '@pulumi/alicloud';

// Create the FC service
const service = new alicloud.fc.Service('qianfeng-pulumi-component-test', {
  name: 'qianfeng-pulumi-component-test',
});


// Create the FC function.
const func = new alicloud.fc.Function('my-function-1', {
  handler: 'index.handler',
  runtime: 'nodejs10',
  memorySize: 128,
  service: service.name,
  filename: './code.zip',
  name: 'my-function-1',
}, { parent: service, dependsOn: service });
I executed ‘s up’ first and then I modified the config of alicloud fc service. And I ran into the error when I executed ‘s up --target urnpulumitest-stack:test projectalicloudfc/serviceService:qianfeng-pulumi-component-test’ to try to update service only.
c
So it looks like you have
parent: service
, as well as
dependsOn: service
. The
dependsOn
is not necessary since the dependency is established implicitly by using a property of
service
, which you are relying on
service.name
when creating your
func
. Try removing the
dependsOn
. Also what does the detailed diff show? You can get the detailed diff by passing
--diff
.
l
Error again without ‘dependsOn’ .
@clever-sunset-76585 Please help me with the error. I had no idea what to do next
--target-dependents can not solve the problem either. And If I removed ‘parents’ and retained ‘dependsOn’, The error won’t appear, which represented that I can not use --target option with ‘parent’. Is this as expected?
c
And If I removed ‘parents’ and retained ‘dependsOn’, The error won’t appear, which represented that I can not use --target option with ‘parent’. Is this as expected?
@little-van-8457 that is not expected. I haven’t used alicloud package myself. I am not sure if there is a bug here but I would not expect the error if Pulumi says that it only needs to
update
the resource’s description and not
replace
it. If it was a
replace
action then I can understand the error. Let me see if someone else if might have an idea as to what’s going on.
l
Thanks a lot.
c
@little-van-8457 can you please provide the contents of your
package.json
?
l
Copy code
{
  "name": "local_test",
  "devDependencies": {
    "@types/node": "^14.14.35"
  },
  "dependencies": {
    "@pulumi/pulumi": "^2.25.1",
    "@pulumi/alicloud": "^2.37.0"
  }
}
@clever-sunset-76585 Here it is.
c
Thanks for providing the contents, @little-van-8457. I was able to reproduce the issue with the CLI version 2.21.2. There were some improvements made to the
--target
functionality in the CLI version 3.x release line. I was able to correctly do a targeted update using the latest CLI version. I did not change the package versions in
package.json
; just installed the latest CLI version. Could you please update your CLI version to the latest as well and let me know how that goes for you?
@little-van-8457 just following up to see if you are good now?
l
Sorry, I was busy these days. I will try it this weekend !Thanks a lot!