mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 12:58:35 +07:00
Fix output values with null
Signed-off-by: Igor Rodionov <goruha@gmail.com>
This commit is contained in:
@@ -294,11 +294,15 @@ func loadOutputs(tfmodule *tfconfig.Module, config *print.Config) ([]*Output, er
|
||||
}
|
||||
|
||||
if config.OutputValues.Enabled {
|
||||
output.Sensitive = values[output.Name].Sensitive
|
||||
if values[output.Name].Sensitive {
|
||||
output.Value = types.ValueOf(`<sensitive>`)
|
||||
if value, ok := values[output.Name]; ok {
|
||||
output.Sensitive = value.Sensitive
|
||||
output.Value = types.ValueOf(value.Value)
|
||||
} else {
|
||||
output.Value = types.ValueOf(values[output.Name].Value)
|
||||
output.Value = types.ValueOf("null")
|
||||
}
|
||||
|
||||
if output.Sensitive {
|
||||
output.Value = types.ValueOf(`<sensitive>`)
|
||||
}
|
||||
}
|
||||
outputs = append(outputs, output)
|
||||
|
||||
@@ -589,7 +589,7 @@ func TestLoadOutputs(t *testing.T) {
|
||||
name: "load module outputs from path",
|
||||
path: "full-example",
|
||||
expected: expected{
|
||||
outputs: 3,
|
||||
outputs: 4,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -665,7 +665,7 @@ func TestLoadOutputsValues(t *testing.T) {
|
||||
path: "full-example",
|
||||
outputPath: "output-values.json",
|
||||
expected: expected{
|
||||
outputs: 3,
|
||||
outputs: 4,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
@@ -896,7 +896,7 @@ func TestSortItems(t *testing.T) {
|
||||
inputs: []string{"D", "B", "E", "A", "C", "F", "G"},
|
||||
required: []string{"A", "F"},
|
||||
optional: []string{"D", "B", "E", "C", "G"},
|
||||
outputs: []string{"C", "A", "B"},
|
||||
outputs: []string{"C", "A", "B", "D"},
|
||||
providers: []string{"tls", "aws", "null"},
|
||||
},
|
||||
},
|
||||
@@ -909,7 +909,7 @@ func TestSortItems(t *testing.T) {
|
||||
inputs: []string{"D", "B", "E", "A", "C", "F", "G"},
|
||||
required: []string{"A", "F"},
|
||||
optional: []string{"D", "B", "E", "C", "G"},
|
||||
outputs: []string{"C", "A", "B"},
|
||||
outputs: []string{"C", "A", "B", "D"},
|
||||
providers: []string{"tls", "aws", "null"},
|
||||
},
|
||||
},
|
||||
@@ -922,7 +922,7 @@ func TestSortItems(t *testing.T) {
|
||||
inputs: []string{"D", "B", "E", "A", "C", "F", "G"},
|
||||
required: []string{"A", "F"},
|
||||
optional: []string{"D", "B", "E", "C", "G"},
|
||||
outputs: []string{"C", "A", "B"},
|
||||
outputs: []string{"C", "A", "B", "D"},
|
||||
providers: []string{"tls", "aws", "null"},
|
||||
},
|
||||
},
|
||||
@@ -935,7 +935,7 @@ func TestSortItems(t *testing.T) {
|
||||
inputs: []string{"A", "B", "C", "D", "E", "F", "G"},
|
||||
required: []string{"A", "F"},
|
||||
optional: []string{"B", "C", "D", "E", "G"},
|
||||
outputs: []string{"A", "B", "C"},
|
||||
outputs: []string{"A", "B", "C", "D"},
|
||||
providers: []string{"aws", "null", "tls"},
|
||||
},
|
||||
},
|
||||
@@ -948,7 +948,7 @@ func TestSortItems(t *testing.T) {
|
||||
inputs: []string{"A", "F", "B", "C", "D", "E", "G"},
|
||||
required: []string{"A", "F"},
|
||||
optional: []string{"B", "C", "D", "E", "G"},
|
||||
outputs: []string{"A", "B", "C"},
|
||||
outputs: []string{"A", "B", "C", "D"},
|
||||
providers: []string{"aws", "null", "tls"},
|
||||
},
|
||||
},
|
||||
@@ -961,7 +961,7 @@ func TestSortItems(t *testing.T) {
|
||||
inputs: []string{"A", "F", "G", "B", "C", "D", "E"},
|
||||
required: []string{"A", "F"},
|
||||
optional: []string{"G", "B", "C", "D", "E"},
|
||||
outputs: []string{"A", "B", "C"},
|
||||
outputs: []string{"A", "B", "C", "D"},
|
||||
providers: []string{"aws", "null", "tls"},
|
||||
},
|
||||
},
|
||||
|
||||
5
terraform/testdata/full-example/outputs.tf
vendored
5
terraform/testdata/full-example/outputs.tf
vendored
@@ -12,3 +12,8 @@ output "A" {
|
||||
output "B" {
|
||||
value = "b"
|
||||
}
|
||||
|
||||
// D null result
|
||||
output "D" {
|
||||
value = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user