Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions plugins/tofu/plugin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package tofu

import (
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/schema"
)

func New() schema.Plugin {
return schema.Plugin{
Name: "tofu",
Platform: schema.PlatformInfo{
Name: "OpenTofu",
Homepage: sdk.URL("https://opentofu.org"),
},
Executables: []schema.Executable{
TofuCLI(),
},
}
}
40 changes: 40 additions & 0 deletions plugins/tofu/terraform.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package tofu

import (
"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/needsauth"
"github.com/1Password/shell-plugins/sdk/schema"
)

func TofuCLI() schema.Executable {
return schema.Executable{
Name: "OpenTofu",
Runs: []string{"tofu"},
DocsURL: sdk.URL("https://opentofu.org/docs/cli"),
NeedsAuth: needsauth.IfAll(
needsauth.NotForHelpOrVersion(),
needsauth.NotWithoutArgs(),
),
Uses: []schema.CredentialUsage{
{
Description: "Credentials to use within the OpenTofu project",
SelectFrom: &schema.CredentialSelection{
ID: "project",
IncludeAllCredentials: true,
AllowMultiple: true,
},
Optional: true,
NeedsAuth: needsauth.IfAny(
needsauth.ForCommand("refresh"),
needsauth.ForCommand("init"),
needsauth.ForCommand("state"),
needsauth.ForCommand("plan"),
needsauth.ForCommand("apply"),
needsauth.ForCommand("destroy"),
needsauth.ForCommand("import"),
needsauth.ForCommand("test"),
),
},
},
}
}