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

[BUG] Terraform scripts crashed during long running subscription #916

Open
1 task done
wope4455 opened this issue Oct 8, 2024 · 3 comments
Open
1 task done

[BUG] Terraform scripts crashed during long running subscription #916

wope4455 opened this issue Oct 8, 2024 · 3 comments
Assignees
Labels
bug Something isn't working needs-triage For new issues

Comments

@wope4455
Copy link
Member

wope4455 commented Oct 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What version of the Terraform provider are you using?

1.7.0

What version of the Terraform CLI are you using?

1.9.2

What type of issue are you facing

bug report

Describe the bug

Terraform script crashed during a long running service subscription exactly after 10 minutes. At the subaccount the subscription process finished well after some additional time and the service is running.
I faced this issue 2 times

Expected Behavior

No response

Steps To Reproduce

Long running subscription of a service like SAP Build ProcessAutomation

User's Role Collections

No response

Add screenshots to help explain your problem

No response

Additional context

btp_subaccount_subscription.sap_build_process: Still creating... [10m0s elapsed]
╷
│ Error: Request cancelled
│ 
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-btp_v1.7.0 plugin:

panic: interface conversion: interface {} is nil, not saas_manager_service.EntitledApplicationsResponseObject

goroutine 60 [running]:
github.com/SAP/terraform-provider-btp/internal/provider.(*subaccountSubscriptionResource).Create(0x1400038c030, {0x1038da348, 0x14000429290}, {{{{0x1038df6b0, 0x1400030d560}, {0x1037a7400, 0x1400030d230}}, {0x1038e2d98, 0x1400016d090}}, {{{0x1038df6b0, ...}, ...}, ...}, ...}, ...)
        github.com/SAP/terraform-provider-btp/internal/provider/resource_subaccount_subscription.go:251 +0x72c
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0x140002061e0, {0x1038da348, 0x14000429290}, 0x140000c5528, 0x140000c5500)
        github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:101 +0x400
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x140002061e0, {0x1038da348, 0x14000429290}, 0x1400009c370, 0x140000c5620)
        github.com/hashicorp/[email protected]/internal/fwserver/server_applyresourcechange.go:57 +0x380
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0x140002061e0, {0x1038da348?, 0x140004291a0?}, 0x1400009c190)
        github.com/hashicorp/[email protected]/internal/proto6server/server_applyresourcechange.go:55 +0x2e0
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x14000210a00, {0x1038da348?, 0x140004282a0?}, 0x140001f6070)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x1038a3b60, 0x14000210a00}, {0x1038da348, 0x140004282a0}, 0x14000426000, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:545 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000196e00, {0x1038da348, 0x140004281e0}, {0x1038e15a0, 0x140003f2000}, 0x140003f8000, 0x1400030c0c0, 0x103e61918, 0x0)
        google.golang.org/[email protected]/server.go:1394 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x14000196e00, {0x1038e15a0, 0x140003f2000}, 0x140003f8000)
        google.golang.org/[email protected]/server.go:1805 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1029 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 52
        google.golang.org/[email protected]/server.go:1040 +0x13c

Error: The terraform-provider-btp_v1.7.0 plugin crashed!
@wope4455 wope4455 added bug Something isn't working needs-triage For new issues labels Oct 8, 2024
@lechnerc77
Copy link
Member

@wope4455 Did you specify a timeout block when defining the resource?

The default timeout for subscriptions is 10 minutes, but you can adjust them via the timeout block (see https://registry.terraform.io/providers/SAP/btp/latest/docs/resources/subaccount_subscription#timeouts)

@wope4455
Copy link
Member Author

wope4455 commented Oct 9, 2024

@wope4455 Did you specify a timeout block when defining the resource?

The default timeout for subscriptions is 10 minutes, but you can adjust them via the timeout block (see https://registry.terraform.io/providers/SAP/btp/latest/docs/resources/subaccount_subscription#timeouts)

@lechnerc77 : thanks for the hint - I haven't used this timeout block - but I would expect that the script would generate a message when reaching that point and does not crash.

@lechnerc77
Copy link
Member

lechnerc77 commented Oct 9, 2024

@wope4455 The handling of the retry block is part of the Terraform Framework, so we have only limited influence on the abort that happens in your case. But we will evaluate if we can influence the behavior on a lower execution level (namely in our client) to exit more gracefully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage For new issues
Projects
None yet
Development

No branches or pull requests

3 participants