|
| 1 | +package terraform |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/1Password/shell-plugins/sdk" |
| 5 | + "github.com/1Password/shell-plugins/sdk/needsauth" |
| 6 | + "github.com/1Password/shell-plugins/sdk/schema" |
| 7 | +) |
| 8 | + |
| 9 | +func OpenTofuCLI() schema.Executable { |
| 10 | + return schema.Executable{ |
| 11 | + Name: "OpenTofu CLI", |
| 12 | + Runs: []string{"tofu"}, |
| 13 | + DocsURL: sdk.URL("https://opentofu.org/docs/cli/"), |
| 14 | + NeedsAuth: needsauth.IfAll( |
| 15 | + needsauth.NotForHelpOrVersion(), |
| 16 | + needsauth.NotWithoutArgs(), |
| 17 | + ), |
| 18 | + Uses: []schema.CredentialUsage{ |
| 19 | + { |
| 20 | + Description: "Credentials to use within the OpenTofu project", |
| 21 | + SelectFrom: &schema.CredentialSelection{ |
| 22 | + ID: "project", |
| 23 | + IncludeAllCredentials: true, |
| 24 | + AllowMultiple: true, |
| 25 | + }, |
| 26 | + Optional: true, |
| 27 | + NeedsAuth: needsauth.IfAny( |
| 28 | + needsauth.ForCommand("refresh"), |
| 29 | + needsauth.ForCommand("init"), |
| 30 | + needsauth.ForCommand("state"), |
| 31 | + needsauth.ForCommand("plan"), |
| 32 | + needsauth.ForCommand("apply"), |
| 33 | + needsauth.ForCommand("destroy"), |
| 34 | + needsauth.ForCommand("import"), |
| 35 | + needsauth.ForCommand("test"), |
| 36 | + ), |
| 37 | + }, |
| 38 | + }, |
| 39 | + } |
| 40 | +} |
0 commit comments