mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-05-20 12:02:01 -04:00
Initial implementation of structured logging in cloud backend (#32504)
* Implementation of structured logging. These are the changes that enable the cloud backend to consume structured logs and make use of the new plan renderer. This will enable CLI-driven runs to view the structured output in the Terraform Cloud UI. * Cloud structured logging unit tests * Remove deferred logs logic, fix minor issues Color formatting fixes, log type stop lists, default behavior for logs that are unknown * Use service disco path in redacted plan url
This commit is contained in:
1
internal/cloud/testdata/plan-json-basic/main.tf
vendored
Normal file
1
internal/cloud/testdata/plan-json-basic/main.tf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
resource "null_resource" "foo" {}
|
||||
116
internal/cloud/testdata/plan-json-basic/plan-redacted.json
vendored
Normal file
116
internal/cloud/testdata/plan-json-basic/plan-redacted.json
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"plan_format_version": "1.1",
|
||||
"resource_drift": [],
|
||||
"resource_changes": [
|
||||
{
|
||||
"address": "null_resource.foo",
|
||||
"mode": "managed",
|
||||
"type": "null_resource",
|
||||
"name": "foo",
|
||||
"provider_name": "registry.terraform.io/hashicorp/null",
|
||||
"change": {
|
||||
"actions": [
|
||||
"create"
|
||||
],
|
||||
"before": null,
|
||||
"after": {
|
||||
"triggers": null
|
||||
},
|
||||
"after_unknown": {
|
||||
"id": true
|
||||
},
|
||||
"before_sensitive": false,
|
||||
"after_sensitive": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"relevant_attributes": [],
|
||||
"output_changes": {},
|
||||
"provider_schemas": {
|
||||
"registry.terraform.io/hashicorp/null": {
|
||||
"provider": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
"description_kind": "plain"
|
||||
}
|
||||
},
|
||||
"resource_schemas": {
|
||||
"null_resource": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
"attributes": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "This is set to a random value at create time.",
|
||||
"description_kind": "plain",
|
||||
"computed": true
|
||||
},
|
||||
"triggers": {
|
||||
"type": [
|
||||
"map",
|
||||
"string"
|
||||
],
|
||||
"description": "A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.",
|
||||
"description_kind": "plain",
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"description": "The `null_resource` resource implements the standard resource lifecycle but takes no further action.\n\nThe `triggers` argument allows specifying an arbitrary set of values that, when changed, will cause the resource to be replaced.",
|
||||
"description_kind": "plain"
|
||||
}
|
||||
}
|
||||
},
|
||||
"data_source_schemas": {
|
||||
"null_data_source": {
|
||||
"version": 0,
|
||||
"block": {
|
||||
"attributes": {
|
||||
"has_computed_default": {
|
||||
"type": "string",
|
||||
"description": "If set, its literal value will be stored and returned. If not, its value defaults to `\"default\"`. This argument exists primarily for testing and has little practical use.",
|
||||
"description_kind": "plain",
|
||||
"optional": true,
|
||||
"computed": true
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.",
|
||||
"description_kind": "plain",
|
||||
"deprecated": true,
|
||||
"computed": true
|
||||
},
|
||||
"inputs": {
|
||||
"type": [
|
||||
"map",
|
||||
"string"
|
||||
],
|
||||
"description": "A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.",
|
||||
"description_kind": "plain",
|
||||
"optional": true
|
||||
},
|
||||
"outputs": {
|
||||
"type": [
|
||||
"map",
|
||||
"string"
|
||||
],
|
||||
"description": "After the data source is \"read\", a copy of the `inputs` map.",
|
||||
"description_kind": "plain",
|
||||
"computed": true
|
||||
},
|
||||
"random": {
|
||||
"type": "string",
|
||||
"description": "A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.",
|
||||
"description_kind": "plain",
|
||||
"computed": true
|
||||
}
|
||||
},
|
||||
"description": "The `null_data_source` data source implements the standard data source lifecycle but does not\ninteract with any external APIs.\n\nHistorically, the `null_data_source` was typically used to construct intermediate values to re-use elsewhere in configuration. The\nsame can now be achieved using [locals](https://www.terraform.io/docs/language/values/locals.html).\n",
|
||||
"description_kind": "plain",
|
||||
"deprecated": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"provider_format_version": "1.0"
|
||||
}
|
||||
3
internal/cloud/testdata/plan-json-basic/plan.log
vendored
Normal file
3
internal/cloud/testdata/plan-json-basic/plan.log
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{"@level":"info","@message":"Terraform 1.3.7","@module":"terraform.ui","@timestamp":"2023-01-19T10:47:27.409143-05:00","terraform":"1.3.7","type":"version","ui":"1.0"}
|
||||
{"@level":"info","@message":"null_resource.foo: Plan to create","@module":"terraform.ui","@timestamp":"2023-01-19T10:47:27.605841-05:00","change":{"resource":{"addr":"null_resource.foo","module":"","resource":"null_resource.foo","implied_provider":"null","resource_type":"null_resource","resource_name":"foo","resource_key":null},"action":"create"},"type":"planned_change"}
|
||||
{"@level":"info","@message":"Plan: 1 to add, 0 to change, 0 to destroy.","@module":"terraform.ui","@timestamp":"2023-01-19T10:47:27.605906-05:00","changes":{"add":1,"change":0,"remove":0,"operation":"plan"},"type":"change_summary"}
|
||||
Reference in New Issue
Block a user