diff --git a/CHANGELOG.md b/CHANGELOG.md index 94fd1c19c..79746df74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v2.4.0 (unreleased) + +ENHANCEMENTS: +- `azapi` resources/data sources: Update embedded schema to the latest version. + + ## v2.3.0 ENHANCEMENTS: diff --git a/internal/langserver/handlers/testdata/TestCompletion_codeSample/expect.json b/internal/langserver/handlers/testdata/TestCompletion_codeSample/expect.json index 0e5b2f777..88ce78437 100644 --- a/internal/langserver/handlers/testdata/TestCompletion_codeSample/expect.json +++ b/internal/langserver/handlers/testdata/TestCompletion_codeSample/expect.json @@ -337,7 +337,7 @@ "character": 2 } }, - "newText": "retry {\n\tinterval_seconds = $1\n\tmax_interval_seconds = $2\n\tmultiplier = $3\n\trandomization_factor = $4\n}" + "newText": "retry = {\n\terror_message_regex = [$0]\n}" }, "command": { "title": "Suggest", diff --git a/internal/langserver/handlers/testdata/TestValidation_commaAfterArrayItem/main.tf b/internal/langserver/handlers/testdata/TestValidation_commaAfterArrayItem/main.tf index 04441a37c..393bc8ec0 100644 --- a/internal/langserver/handlers/testdata/TestValidation_commaAfterArrayItem/main.tf +++ b/internal/langserver/handlers/testdata/TestValidation_commaAfterArrayItem/main.tf @@ -1,5 +1,5 @@ resource "azapi_resource" "diagnostics" { - type = "microsoft.insights/diagnosticSettings@2017-05-01-preview" + type = "microsoft.insights/diagnosticSettings@2021-05-01-preview" name = "somename" parent_id = azapi_resource.automationAccount.id body = jsonencode({ diff --git a/internal/langserver/handlers/tfschema/init.go b/internal/langserver/handlers/tfschema/init.go index b678d62da..cb2041500 100644 --- a/internal/langserver/handlers/tfschema/init.go +++ b/internal/langserver/handlers/tfschema/init.go @@ -10,8 +10,16 @@ func init() { Modifier: "Optional", Type: "block", Description: "Configuration block for custom retry policy.", - CompletionNewText: "retry {\n\tinterval_seconds = $1\n\tmax_interval_seconds = $2\n\tmultiplier = $3\n\trandomization_factor = $4\n}", + CompletionNewText: "retry = {\n\terror_message_regex = [$0]\n}", NestedProperties: []Property{ + { + Name: "error_message_regex", + Modifier: "Required", + Type: "list", + Description: "A list of regular expressions to match against error messages. If any of the regular expressions match, the request will be retried.", + CompletionNewText: "error_message_regex = [$0]", + }, + { Name: "interval_seconds", Modifier: "Optional", @@ -606,6 +614,14 @@ func init() { GenericCandidatesFunc: bodyCandidates, }, + { + Name: "locks", + Modifier: "Optional", + Type: "list", + Description: "A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.", + CompletionNewText: `locks = [$0]`, + }, + { Name: "response_export_values", Modifier: "Optional", @@ -614,6 +630,14 @@ func init() { CompletionNewText: `response_export_values = [$0]`, }, + { + Name: "sensitive_response_export_values", + Modifier: "Optional", + Type: "list or map", + Description: "The attribute can accept either a list or a map of path that needs to be exported from response body as sensitive.", + CompletionNewText: `sensitive_response_export_values = [$0]`, + }, + retryProperty, { @@ -689,6 +713,14 @@ func init() { CompletionNewText: `response_export_values = [$0]`, }, + { + Name: "sensitive_response_export_values", + Modifier: "Optional", + Type: "list or map", + Description: "The attribute can accept either a list or a map of path that needs to be exported from response body as sensitive.", + CompletionNewText: `sensitive_response_export_values = [$0]`, + }, + retryProperty, { @@ -792,5 +824,88 @@ func init() { }, }, }, + Resource{ + Name: "ephemeral.azapi_resource_action", + Properties: []Property{ + { + Name: "type", + Modifier: "Required", + Type: "string @", + Description: "Azure Resource Manager type.", + CompletionNewText: `type = "$0"`, + ValueCandidatesFunc: typeCandidates, + }, + + { + Name: "resource_id", + Modifier: "Required", + Type: "string", + Description: "The ID of an existing azure source.", + CompletionNewText: `resource_id = $0`, + }, + + { + Name: "action", + Modifier: "Optional", + Type: "string", + Description: "Specifies the name of the azure resource action.", + CompletionNewText: `action = "$0"`, + GenericCandidatesFunc: actionCandidates, + }, + + { + Name: "method", + Modifier: "Optional", + Type: "string", + Description: "Specifies the Http method of the azure resource action. Defaults to `POST`", + CompletionNewText: `method = $0`, + ValueCandidatesFunc: dataSourceHttpMethodCandidates, + }, + + { + Name: "body", + Modifier: "Optional", + Type: "dynamic", + Description: "An HCL object that contains the request body.", + CompletionNewText: `body = $0`, + ValueCandidatesFunc: FixedValueCandidatesFunc([]lsp.CompletionItem{dynamicPlaceholderCandidate()}), + GenericCandidatesFunc: bodyCandidates, + }, + + { + Name: "locks", + Modifier: "Optional", + Type: "list", + Description: "A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time.", + CompletionNewText: `locks = [$0]`, + }, + + { + Name: "response_export_values", + Modifier: "Optional", + Type: "list or map", + Description: "The attribute can accept either a list or a map of path that needs to be exported from response body.", + CompletionNewText: `response_export_values = [$0]`, + }, + + retryProperty, + + { + Name: "headers", + Modifier: "Optional", + Type: "map", + Description: "A mapping of headers which should be sent with the request.", + CompletionNewText: `headers = $0`, + }, + + { + Name: "query_parameters", + Modifier: "Optional", + Type: "map>", + Description: "A mapping of query parameters which should be sent with the request.", + CompletionNewText: `query_parameters = $0`, + }, + }, + }, ) }