github.com/opentofu/opentofu@v1.7.1/internal/legacy/tofu/ui_input.go (about) 1 // Copyright (c) The OpenTofu Authors 2 // SPDX-License-Identifier: MPL-2.0 3 // Copyright (c) 2023 HashiCorp, Inc. 4 // SPDX-License-Identifier: MPL-2.0 5 6 package tofu 7 8 import "context" 9 10 // UIInput is the interface that must be implemented to ask for input 11 // from this user. This should forward the request to wherever the user 12 // inputs things to ask for values. 13 type UIInput interface { 14 Input(context.Context, *InputOpts) (string, error) 15 } 16 17 // InputOpts are options for asking for input. 18 type InputOpts struct { 19 // Id is a unique ID for the question being asked that might be 20 // used for logging or to look up a prior answered question. 21 Id string 22 23 // Query is a human-friendly question for inputting this value. 24 Query string 25 26 // Description is a description about what this option is. Be wary 27 // that this will probably be in a terminal so split lines as you see 28 // necessary. 29 Description string 30 31 // Default will be the value returned if no data is entered. 32 Default string 33 34 // Secret should be true if we are asking for sensitive input. 35 // If attached to a TTY, OpenTofu will disable echo. 36 Secret bool 37 }