Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions internal/datasource/list_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ func (g GeneratorListNestedAttribute) GetAttributes() schema.GeneratorAttributes
return g.NestedObject.Attributes
}

func (g GeneratorListNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorListNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -223,7 +229,7 @@ func (g GeneratorListNestedAttribute) CustomTypeAndValue(name string) ([]byte, e
// CustomTypeAndValue interface.
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
14 changes: 11 additions & 3 deletions internal/datasource/list_nested_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ func (g GeneratorListNestedBlock) GetBlocks() schema.GeneratorBlocks {
return g.NestedObject.Blocks
}

func (g GeneratorListNestedBlock) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorListNestedBlock) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -285,7 +291,7 @@ func (g GeneratorListNestedBlock) CustomTypeAndValue(name string) ([]byte, error
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand All @@ -297,13 +303,15 @@ func (g GeneratorListNestedBlock) CustomTypeAndValue(name string) ([]byte, error

for _, k := range blockKeys {
if c, ok := g.NestedObject.Blocks[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
}

buf.Write(b)

continue
}
}

Expand Down
10 changes: 8 additions & 2 deletions internal/datasource/map_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ func (g GeneratorMapNestedAttribute) GetAttributes() schema.GeneratorAttributes
return g.NestedObject.Attributes
}

func (g GeneratorMapNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorMapNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -223,7 +229,7 @@ func (g GeneratorMapNestedAttribute) CustomTypeAndValue(name string) ([]byte, er
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
10 changes: 8 additions & 2 deletions internal/datasource/set_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ func (g GeneratorSetNestedAttribute) GetAttributes() schema.GeneratorAttributes
return g.NestedObject.Attributes
}

func (g GeneratorSetNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorSetNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -223,7 +229,7 @@ func (g GeneratorSetNestedAttribute) CustomTypeAndValue(name string) ([]byte, er
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
14 changes: 11 additions & 3 deletions internal/datasource/set_nested_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ func (g GeneratorSetNestedBlock) GetBlocks() schema.GeneratorBlocks {
return g.NestedObject.Blocks
}

func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -285,7 +291,7 @@ func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string) ([]byte, error)
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand All @@ -297,13 +303,15 @@ func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string) ([]byte, error)

for _, k := range blockKeys {
if c, ok := g.NestedObject.Blocks[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
}

buf.Write(b)

continue
}
}

Expand Down
10 changes: 8 additions & 2 deletions internal/datasource/single_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ func (g GeneratorSingleNestedAttribute) GetAttributes() schema.GeneratorAttribut
return g.Attributes
}

func (g GeneratorSingleNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorSingleNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.Attributes.AttrValues()
Expand Down Expand Up @@ -216,7 +222,7 @@ func (g GeneratorSingleNestedAttribute) CustomTypeAndValue(name string) ([]byte,
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
12 changes: 9 additions & 3 deletions internal/datasource/single_nested_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ func (g GeneratorSingleNestedBlock) GetBlocks() schema.GeneratorBlocks {
return g.Blocks
}

func (g GeneratorSingleNestedBlock) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorSingleNestedBlock) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.Attributes.AttrValues()
Expand Down Expand Up @@ -298,7 +304,7 @@ func (g GeneratorSingleNestedBlock) CustomTypeAndValue(name string) ([]byte, err
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand All @@ -310,7 +316,7 @@ func (g GeneratorSingleNestedBlock) CustomTypeAndValue(name string) ([]byte, err

for _, k := range blockKeys {
if c, ok := g.Blocks[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
10 changes: 8 additions & 2 deletions internal/provider/list_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ func (g GeneratorListNestedAttribute) GetAttributes() schema.GeneratorAttributes
return g.NestedObject.Attributes
}

func (g GeneratorListNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorListNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -223,7 +229,7 @@ func (g GeneratorListNestedAttribute) CustomTypeAndValue(name string) ([]byte, e
// CustomTypeAndValue interface.
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
14 changes: 11 additions & 3 deletions internal/provider/list_nested_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ func (g GeneratorListNestedBlock) GetBlocks() schema.GeneratorBlocks {
return g.NestedObject.Blocks
}

func (g GeneratorListNestedBlock) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorListNestedBlock) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -285,7 +291,7 @@ func (g GeneratorListNestedBlock) CustomTypeAndValue(name string) ([]byte, error
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand All @@ -297,13 +303,15 @@ func (g GeneratorListNestedBlock) CustomTypeAndValue(name string) ([]byte, error

for _, k := range blockKeys {
if c, ok := g.NestedObject.Blocks[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
}

buf.Write(b)

continue
}
}

Expand Down
10 changes: 8 additions & 2 deletions internal/provider/map_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ func (g GeneratorMapNestedAttribute) GetAttributes() schema.GeneratorAttributes
return g.NestedObject.Attributes
}

func (g GeneratorMapNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorMapNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -223,7 +229,7 @@ func (g GeneratorMapNestedAttribute) CustomTypeAndValue(name string) ([]byte, er
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
10 changes: 8 additions & 2 deletions internal/provider/set_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ func (g GeneratorSetNestedAttribute) GetAttributes() schema.GeneratorAttributes
return g.NestedObject.Attributes
}

func (g GeneratorSetNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorSetNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -223,7 +229,7 @@ func (g GeneratorSetNestedAttribute) CustomTypeAndValue(name string) ([]byte, er
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
14 changes: 11 additions & 3 deletions internal/provider/set_nested_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ func (g GeneratorSetNestedBlock) GetBlocks() schema.GeneratorBlocks {
return g.NestedObject.Blocks
}

func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.NestedObject.Attributes.AttrValues()
Expand Down Expand Up @@ -285,7 +291,7 @@ func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string) ([]byte, error)
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.NestedObject.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand All @@ -297,13 +303,15 @@ func (g GeneratorSetNestedBlock) CustomTypeAndValue(name string) ([]byte, error)

for _, k := range blockKeys {
if c, ok := g.NestedObject.Blocks[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
}

buf.Write(b)

continue
}
}

Expand Down
10 changes: 8 additions & 2 deletions internal/provider/single_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ func (g GeneratorSingleNestedAttribute) GetAttributes() schema.GeneratorAttribut
return g.Attributes
}

func (g GeneratorSingleNestedAttribute) CustomTypeAndValue(name string) ([]byte, error) {
func (g GeneratorSingleNestedAttribute) CustomTypeAndValue(name string, generated map[string]struct{}) ([]byte, error) {
if _, ok := generated[name]; ok {
return nil, nil
}

generated[name] = struct{}{}

var buf bytes.Buffer

attributeAttrValues, err := g.Attributes.AttrValues()
Expand Down Expand Up @@ -216,7 +222,7 @@ func (g GeneratorSingleNestedAttribute) CustomTypeAndValue(name string) ([]byte,
// CustomTypeAndValue interface (i.e, nested attributes).
for _, k := range attributeKeys {
if c, ok := g.Attributes[k].(schema.CustomTypeAndValue); ok {
b, err := c.CustomTypeAndValue(k)
b, err := c.CustomTypeAndValue(k, generated)

if err != nil {
return nil, err
Expand Down
Loading