in internal/schema/connection.go [15:138]
func GetEsFWConnectionBlock(keyName string, isProviderConfiguration bool) fwschema.Block {
usernamePath := path.MatchRelative().AtParent().AtName("username")
passwordPath := path.MatchRelative().AtParent().AtName("password")
apiKeyPath := path.MatchRelative().AtParent().AtName("api_key")
bearerTokenPath := path.MatchRelative().AtParent().AtName("bearer_token")
caFilePath := path.MatchRelative().AtParent().AtName("ca_file")
caDataPath := path.MatchRelative().AtParent().AtName("ca_data")
certFilePath := path.MatchRelative().AtParent().AtName("cert_file")
certDataPath := path.MatchRelative().AtParent().AtName("cert_data")
keyFilePath := path.MatchRelative().AtParent().AtName("key_file")
keyDataPath := path.MatchRelative().AtParent().AtName("key_data")
return fwschema.ListNestedBlock{
MarkdownDescription: "Elasticsearch connection configuration block. ",
Description: "Elasticsearch connection configuration block. ",
DeprecationMessage: getDeprecationMessage(isProviderConfiguration),
NestedObject: fwschema.NestedBlockObject{
Attributes: map[string]fwschema.Attribute{
"username": fwschema.StringAttribute{
MarkdownDescription: "Username to use for API authentication to Elasticsearch.",
Optional: true,
Validators: []validator.String{stringvalidator.AlsoRequires(passwordPath)},
},
"password": fwschema.StringAttribute{
MarkdownDescription: "Password to use for API authentication to Elasticsearch.",
Optional: true,
Sensitive: true,
Validators: []validator.String{stringvalidator.AlsoRequires(usernamePath)},
},
"api_key": fwschema.StringAttribute{
MarkdownDescription: "API Key to use for authentication to Elasticsearch",
Optional: true,
Sensitive: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(usernamePath, passwordPath, bearerTokenPath),
},
},
"bearer_token": fwschema.StringAttribute{
MarkdownDescription: "Bearer Token to use for authentication to Elasticsearch",
Optional: true,
Sensitive: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(usernamePath, passwordPath, apiKeyPath),
},
},
"es_client_authentication": fwschema.StringAttribute{
MarkdownDescription: "ES Client Authentication field to be used with the JWT token",
Optional: true,
Sensitive: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(usernamePath, passwordPath, apiKeyPath),
stringvalidator.AlsoRequires(bearerTokenPath),
},
},
"endpoints": fwschema.ListAttribute{
MarkdownDescription: "A list of endpoints where the terraform provider will point to, this must include the http(s) schema and port number.",
Optional: true,
Sensitive: true,
ElementType: types.StringType,
},
"headers": fwschema.MapAttribute{
MarkdownDescription: "A list of headers to be sent with each request to Elasticsearch.",
Optional: true,
Sensitive: true,
ElementType: types.StringType,
},
"insecure": fwschema.BoolAttribute{
MarkdownDescription: "Disable TLS certificate validation",
Optional: true,
},
"ca_file": fwschema.StringAttribute{
MarkdownDescription: "Path to a custom Certificate Authority certificate",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(caDataPath),
},
},
"ca_data": fwschema.StringAttribute{
MarkdownDescription: "PEM-encoded custom Certificate Authority certificate",
Optional: true,
Validators: []validator.String{
stringvalidator.ConflictsWith(caFilePath),
},
},
"cert_file": fwschema.StringAttribute{
MarkdownDescription: "Path to a file containing the PEM encoded certificate for client auth",
Optional: true,
Validators: []validator.String{
stringvalidator.AlsoRequires(keyFilePath),
stringvalidator.ConflictsWith(caDataPath, keyDataPath),
},
},
"key_file": fwschema.StringAttribute{
MarkdownDescription: "Path to a file containing the PEM encoded private key for client auth",
Optional: true,
Validators: []validator.String{
stringvalidator.AlsoRequires(certFilePath),
stringvalidator.ConflictsWith(certDataPath, keyDataPath),
},
},
"cert_data": fwschema.StringAttribute{
MarkdownDescription: "PEM encoded certificate for client auth",
Optional: true,
Validators: []validator.String{
stringvalidator.AlsoRequires(keyDataPath),
stringvalidator.ConflictsWith(certFilePath, keyFilePath),
},
},
"key_data": fwschema.StringAttribute{
MarkdownDescription: "PEM encoded private key for client auth",
Optional: true,
Sensitive: true,
Validators: []validator.String{
stringvalidator.AlsoRequires(certDataPath),
stringvalidator.ConflictsWith(certFilePath, keyFilePath),
},
},
},
},
Validators: []validator.List{
listvalidator.SizeAtMost(1),
},
}
}