github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/legacy/terraform/ui_input.go (about)

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