Skip to content

Commit

Permalink
fix files model
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Apr 22, 2024
1 parent 90e8371 commit 449bddf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example/stack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ data "plural_git_repository" "repository" {
}

resource "plural_infrastructure_stack" "stack" {
name = "tf-stack-2"
name = "tf-stack-4"
type = "TERRAFORM"
# approval = false
approval = true
cluster_id = data.plural_cluster.cluster.id
repository = {
id = data.plural_git_repository.repository.id
Expand Down
4 changes: 4 additions & 0 deletions internal/resource/infrastructure_stack_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func (is *infrastructureStack) From(stack *gqlclient.InfrastructureStackFragment
}

func infrastructureStackFilesFrom(files []*gqlclient.StackFileFragment, d diag.Diagnostics) basetypes.MapValue {
if len(files) == 0 {
return types.MapNull(types.StringType)
}

resultMap := make(map[string]attr.Value, len(files))
for _, file := range files {
resultMap[file.Path] = types.StringValue(file.Content)
Expand Down

0 comments on commit 449bddf

Please sign in to comment.