Updates for terraform-plugin-framework v0.7.0 (#40)
Reference: https://github.com/hashicorp/terraform-plugin-framework/releases/tag/v0.7.0
This commit is contained in:
		
							parent
							
								
									2db8ff9bdd
								
							
						
					
					
						commit
						16a0751849
					
				| @ -13,6 +13,7 @@ import ( | ||||
| // Ensure provider defined types fully satisfy framework interfaces
 | ||||
| var _ tfsdk.ResourceType = exampleResourceType{} | ||||
| var _ tfsdk.Resource = exampleResource{} | ||||
| var _ tfsdk.ResourceWithImportState = exampleResource{} | ||||
| 
 | ||||
| type exampleResourceType struct{} | ||||
| 
 | ||||
| @ -148,8 +149,6 @@ func (r exampleResource) Delete(ctx context.Context, req tfsdk.DeleteResourceReq | ||||
| 	//     resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to delete example, got error: %s", err))
 | ||||
| 	//     return
 | ||||
| 	// }
 | ||||
| 
 | ||||
| 	resp.State.RemoveResource(ctx) | ||||
| } | ||||
| 
 | ||||
| func (r exampleResource) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { | ||||
|  | ||||
| @ -3,7 +3,7 @@ package provider | ||||
| import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/hashicorp/terraform-plugin-framework/tfsdk" | ||||
| 	"github.com/hashicorp/terraform-plugin-framework/providerserver" | ||||
| 	"github.com/hashicorp/terraform-plugin-go/tfprotov6" | ||||
| ) | ||||
| 
 | ||||
| @ -12,9 +12,7 @@ import ( | ||||
| // CLI command executed to create a provider server to which the CLI can
 | ||||
| // reattach.
 | ||||
| var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){ | ||||
| 	"scaffolding": func() (tfprotov6.ProviderServer, error) { | ||||
| 		return tfsdk.NewProtocol6Server(New("test")()), nil | ||||
| 	}, | ||||
| 	"scaffolding": providerserver.NewProtocol6WithError(New("test")()), | ||||
| } | ||||
| 
 | ||||
| func testAccPreCheck(t *testing.T) { | ||||
|  | ||||
							
								
								
									
										11
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								main.go
									
									
									
									
									
								
							| @ -5,7 +5,7 @@ import ( | ||||
| 	"flag" | ||||
| 	"log" | ||||
| 
 | ||||
| 	"github.com/hashicorp/terraform-plugin-framework/tfsdk" | ||||
| 	"github.com/hashicorp/terraform-plugin-framework/providerserver" | ||||
| 	"github.com/hashicorp/terraform-provider-scaffolding-framework/internal/provider" | ||||
| ) | ||||
| 
 | ||||
| @ -34,14 +34,13 @@ func main() { | ||||
| 	flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve") | ||||
| 	flag.Parse() | ||||
| 
 | ||||
| 	opts := tfsdk.ServeOpts{ | ||||
| 		Debug: debug, | ||||
| 
 | ||||
| 	opts := providerserver.ServeOpts{ | ||||
| 		// TODO: Update this string with the published name of your provider.
 | ||||
| 		Name: "registry.terraform.io/hashicorp/scaffolding", | ||||
| 		Address: "registry.terraform.io/hashicorp/scaffolding", | ||||
| 		Debug:   debug, | ||||
| 	} | ||||
| 
 | ||||
| 	err := tfsdk.Serve(context.Background(), provider.New(version), opts) | ||||
| 	err := providerserver.Serve(context.Background(), provider.New(version), opts) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		log.Fatal(err.Error()) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Brian Flad
						Brian Flad