Skip to content

Commit

Permalink
Removed type from outputs
Browse files Browse the repository at this point in the history
Here are two drawbacks of exposing type in outputs.
- it’s in Terraform context, not friendly to Golang/Kubernetes
- it’s complicated

Fix #274

Signed-off-by: Zheng Xi Zhou <[email protected]>
  • Loading branch information
zzxwill committed Mar 12, 2022
1 parent 411ac7e commit a369b1a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion api/v1beta2/configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ type ConfigurationDestroyStatus struct {
// Property is the property for an output
type Property struct {
Value string `json:"value,omitempty"`
Type string `json:"type,omitempty"`
}

// Backend stores the state in a Kubernetes secret with locking done using a Lease resource.
Expand Down
2 changes: 0 additions & 2 deletions chart/crds/terraform.core.oam.dev_configurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,6 @@ spec:
additionalProperties:
description: Property is the property for an output
properties:
type:
type: string
value:
type: string
type: object
Expand Down
5 changes: 2 additions & 3 deletions controllers/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ func (meta *TFConfigurationMeta) createTFBackendVolume() v1.Volume {
// TfStateProperty is the tf state property for an output
type TfStateProperty struct {
Value interface{} `json:"value,omitempty"`
Type string `json:"type,omitempty"`
Type interface{} `json:"type,omitempty"`
}

// ToProperty converts TfStateProperty type to Property
Expand All @@ -728,10 +728,9 @@ func (tp *TfStateProperty) ToProperty() (v1beta2.Property, error) {
)
sv, err := tfcfg.Interface2String(tp.Value)
if err != nil {
return property, errors.Wrap(err, "failed to get terraform state outputs")
return property, errors.Wrapf(err, "failed to convert value %s of terraform state outputs to string", tp.Value)
}
property = v1beta2.Property{
Type: tp.Type,
Value: sv,
}
return property, err
Expand Down

0 comments on commit a369b1a

Please sign in to comment.