hcl2template: Rename Datasource type to DatasourceBlock

azr_implicit_requried_plugin_2
Adrien Delorme 5 years ago
parent 7e4948502f
commit 47fa09a9c9

@ -344,7 +344,7 @@ var cmpOpts = []cmp.Option{
PackerConfig{},
Variable{},
SourceBlock{},
Datasource{},
DatasourceBlock{},
ProvisionerBlock{},
PostProcessorBlock{},
packer.CoreBuild{},

@ -11,8 +11,8 @@ import (
"github.com/zclconf/go-cty/cty"
)
// DataBlock references an HCL 'data' block.
type Datasource struct {
// DatasourceBlock references an HCL 'data' block.
type DatasourceBlock struct {
Type string
Name string
@ -25,9 +25,9 @@ type DatasourceRef struct {
Name string
}
type Datasources map[DatasourceRef]Datasource
type Datasources map[DatasourceRef]DatasourceBlock
func (data *Datasource) Ref() DatasourceRef {
func (data *DatasourceBlock) Ref() DatasourceRef {
return DatasourceRef{
Type: data.Type,
Name: data.Name,
@ -124,9 +124,9 @@ func (cfg *PackerConfig) startDatasource(dataSourceStore packer.DatasourceStore,
return datasource, diags
}
func (p *Parser) decodeDataBlock(block *hcl.Block) (*Datasource, hcl.Diagnostics) {
func (p *Parser) decodeDataBlock(block *hcl.Block) (*DatasourceBlock, hcl.Diagnostics) {
var diags hcl.Diagnostics
r := &Datasource{
r := &DatasourceBlock{
Type: block.Labels[0],
Name: block.Labels[1],
block: block,

@ -131,7 +131,7 @@ func TestParser_complete(t *testing.T) {
},
},
Datasources: Datasources{
DatasourceRef{Type: "amazon-ami", Name: "test"}: Datasource{
DatasourceRef{Type: "amazon-ami", Name: "test"}: DatasourceBlock{
Type: "amazon-ami",
Name: "test",
value: cty.StringVal("foo"),

Loading…
Cancel
Save