mirror of
https://github.com/opentofu/terraform-provider-vault.git
synced 2026-01-11 19:46:35 +00:00
* Multiplex provider to support both SDKv2 and Plugin Framework * [Phase 1] Multiplex provider - minimal TF Plugin Framework provider implementation (#2067) * [Phase 2] Complete the provider configuration setup (#2090) * [Phase 3] Include Auth Login blocks in multiplexed Provider configuration (#2097) * [Phase 4] Migrate resource `vault_password_policy` to new FW and add tests Co-authored-by: Vinay Gopalan <vinay@hashicorp.com> Co-authored-by: JM Faircloth <jmfaircloth@hashicorp.com>
43 lines
998 B
Go
43 lines
998 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"log"
|
|
|
|
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server"
|
|
"github.com/hashicorp/terraform-provider-vault/vault"
|
|
)
|
|
|
|
func main() {
|
|
serverFactory, _, err := vault.ProtoV5ProviderServerFactory(context.Background())
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
var serveOpts []tf5server.ServeOpt
|
|
|
|
var debug bool
|
|
flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
|
|
flag.Parse()
|
|
if debug {
|
|
serveOpts = append(serveOpts, tf5server.WithManagedDebug())
|
|
}
|
|
|
|
// fix duplicate timestamp and incorrect level messages for legacy sdk v2
|
|
// https://developer.hashicorp.com/terraform/plugin/log/writing#legacy-log-troubleshooting
|
|
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
|
|
|
|
err = tf5server.Serve(
|
|
"registry.terraform.io/hashicorp/vault",
|
|
serverFactory,
|
|
serveOpts...,
|
|
)
|
|
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|