feat: display terraform provider version in output
parent
0eddd54b30
commit
92691868bb
|
@ -9,6 +9,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/cloudskiff/driftctl/pkg/telemetry"
|
"github.com/cloudskiff/driftctl/pkg/telemetry"
|
||||||
|
"github.com/fatih/color"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -228,6 +229,8 @@ func scanRun(opts *pkg.ScanOptions) error {
|
||||||
telemetry.SendTelemetry(analysis)
|
telemetry.SendTelemetry(analysis)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globaloutput.Printf(color.WhiteString("Provider version used to scan: %s. Use --tf-provider-version to use another version.\n"), resourceSchemaRepository.ProviderVersion.String())
|
||||||
|
|
||||||
if !analysis.IsSync() {
|
if !analysis.IsSync() {
|
||||||
globaloutput.Printf("\nHint: use gen-driftignore command to generate a .driftignore file based on your drifts\n")
|
globaloutput.Printf("\nHint: use gen-driftignore command to generate a .driftignore file based on your drifts\n")
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,8 @@ type SchemaRepositoryInterface interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SchemaRepository struct {
|
type SchemaRepository struct {
|
||||||
schemas map[string]*Schema
|
schemas map[string]*Schema
|
||||||
|
ProviderVersion *version.Version
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSchemaRepository() *SchemaRepository {
|
func NewSchemaRepository() *SchemaRepository {
|
||||||
|
@ -81,6 +82,7 @@ func (r *SchemaRepository) Init(v string, schema map[string]providers.Schema) er
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
r.ProviderVersion = providerVersion
|
||||||
for typ, sch := range schema {
|
for typ, sch := range schema {
|
||||||
attributeMetas := map[string]AttributeSchema{}
|
attributeMetas := map[string]AttributeSchema{}
|
||||||
for s, attribute := range sch.Block.Attributes {
|
for s, attribute := range sch.Block.Attributes {
|
||||||
|
@ -92,7 +94,7 @@ func (r *SchemaRepository) Init(v string, schema map[string]providers.Schema) er
|
||||||
r.fetchNestedBlocks("", attributeMetas, sch.Block.BlockTypes)
|
r.fetchNestedBlocks("", attributeMetas, sch.Block.BlockTypes)
|
||||||
|
|
||||||
r.schemas[typ] = &Schema{
|
r.schemas[typ] = &Schema{
|
||||||
ProviderVersion: providerVersion,
|
ProviderVersion: r.ProviderVersion,
|
||||||
SchemaVersion: sch.Version,
|
SchemaVersion: sch.Version,
|
||||||
Attributes: attributeMetas,
|
Attributes: attributeMetas,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue