github.com/crossplane/upjet@v1.3.0/pkg/resource/interfaces.go (about) 1 // SPDX-FileCopyrightText: 2023 The Crossplane Authors <https://crossplane.io> 2 // 3 // SPDX-License-Identifier: Apache-2.0 4 5 package resource 6 7 import ( 8 "github.com/crossplane/crossplane-runtime/pkg/resource" 9 ) 10 11 // Observable structs can get and set observations in the form of Terraform JSON. 12 type Observable interface { 13 GetObservation() (map[string]any, error) 14 SetObservation(map[string]any) error 15 GetID() string 16 } 17 18 // Parameterizable structs can get and set parameters of the managed resource 19 // using map form of Terraform JSON. 20 type Parameterizable interface { 21 GetParameters() (map[string]any, error) 22 SetParameters(map[string]any) error 23 GetInitParameters() (map[string]any, error) 24 GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) 25 } 26 27 // MetadataProvider provides Terraform metadata for the Terraform managed 28 // resource. 29 type MetadataProvider interface { 30 GetTerraformResourceType() string 31 GetTerraformSchemaVersion() int 32 GetConnectionDetailsMapping() map[string]string 33 } 34 35 // LateInitializer late-initializes the managed resource from observed Terraform 36 // state. 37 type LateInitializer interface { 38 // LateInitialize this Terraformed resource using its observed tfState. 39 // returns True if the there are any spec changes for the resource. 40 LateInitialize(attrs []byte) (bool, error) 41 } 42 43 // Terraformed is a Kubernetes object representing a concrete terraform managed 44 // resource. 45 type Terraformed interface { 46 resource.Managed 47 48 MetadataProvider 49 Observable 50 Parameterizable 51 LateInitializer 52 }