Skip to content

Commit

Permalink
Remove experimental (broken) packer_build data source
Browse files Browse the repository at this point in the history
It does not really do what it is designed to do. While it works in some
cases, it does not look like it can be used for its indended purpose.

Since this is an experimental feature, it will be removed now without
prior notice.
  • Loading branch information
simaotwx committed Sep 8, 2022
1 parent 365993d commit a974f0a
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 280 deletions.
26 changes: 0 additions & 26 deletions docs/data-sources/build.md

This file was deleted.

8 changes: 0 additions & 8 deletions examples/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ resource "packer_image" "image2" {
}
}

data "packer_build" "image2_wait" {
name = random_string.random.result
}

output "packer_version" {
value = data.packer_version.version.version
}
Expand All @@ -69,10 +65,6 @@ output "build_uuid_2" {
value = resource.packer_image.image2.build_uuid
}

output "build_wait_uuid_2" {
value = data.packer_build.image2_wait.uuid
}

output "file_hash_1" {
value = data.packer_files.files1.files_hash
}
80 changes: 0 additions & 80 deletions provider/data_source_packer_build.go

This file was deleted.

1 change: 0 additions & 1 deletion provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ func (p *tfProvider) GetDataSources(_ context.Context) (map[string]provider.Data
return map[string]provider.DataSourceType{
"packer_version": dataSourceVersionType{},
"packer_files": dataSourceFilesType{},
"packer_build": dataSourceBuildType{},
}, nil
}
20 changes: 0 additions & 20 deletions provider/resource_packer_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ func (r resourceImage) Create(ctx context.Context, req resource.CreateRequest, r
return
}

if err := state.StartBuild(&resourceState); err != nil {
resp.Diagnostics.AddError("Failed to mark build as started", err.Error())
return
}

err := r.packerInit(&resourceState)
if err != nil {
resp.Diagnostics.AddError("Failed to run packer init", err.Error())
Expand All @@ -201,9 +196,6 @@ func (r resourceImage) Create(ctx context.Context, req resource.CreateRequest, r
return
}

state.RefreshBuildData(&resourceState)
state.CompleteBuild(resourceState.Name.Value, true)

diags = resp.State.Set(ctx, &resourceState)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand All @@ -219,10 +211,6 @@ func (r resourceImage) Read(ctx context.Context, req resource.ReadRequest, resp
return
}

if !resourceState.Name.Null {
state.RefreshBuildData(&resourceState)
}

diags = resp.State.Set(ctx, &resourceState)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand All @@ -245,11 +233,6 @@ func (r resourceImage) Update(ctx context.Context, req resource.UpdateRequest, r
return
}

if err := state.StartBuild(&resourceState); err != nil {
resp.Diagnostics.AddError("Failed to mark build as started", err.Error())
return
}

err := r.packerInit(&plan)
if err != nil {
resp.Diagnostics.AddError("Failed to run packer init", err.Error())
Expand All @@ -266,9 +249,6 @@ func (r resourceImage) Update(ctx context.Context, req resource.UpdateRequest, r
return
}

state.RefreshBuildData(&plan)
state.CompleteBuild(resourceState.Name.Value, true)

diags = resp.State.Set(ctx, plan)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down
145 changes: 0 additions & 145 deletions provider/sync.go

This file was deleted.

0 comments on commit a974f0a

Please sign in to comment.