mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 09:36:44 +00:00
![Riley Karson](/assets/img/avatar_default.png)
```bash GO111MODULE=on go get github.com/hashicorp/terraform@pluginsdk-v0.12-early7 GO111MODULE=on go mod vendor GO111MODULE=on go mod tidy ```
24 lines
584 B
Go
24 lines
584 B
Go
package plugin
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hashicorp/go-plugin/internal/plugin"
|
|
)
|
|
|
|
// GRPCControllerServer handles shutdown calls to terminate the server when the
|
|
// plugin client is closed.
|
|
type grpcControllerServer struct {
|
|
server *GRPCServer
|
|
}
|
|
|
|
// Shutdown stops the grpc server. It first will attempt a graceful stop, then a
|
|
// full stop on the server.
|
|
func (s *grpcControllerServer) Shutdown(ctx context.Context, _ *plugin.Empty) (*plugin.Empty, error) {
|
|
resp := &plugin.Empty{}
|
|
|
|
// TODO: figure out why GracefullStop doesn't work.
|
|
s.server.Stop()
|
|
return resp, nil
|
|
}
|