|
|
|
@ -62,8 +62,9 @@ type ResourceChangeFilter struct {
|
|
|
|
|
|
|
|
|
|
type TerraformShowResourceChange struct { |
|
|
|
|
TerraformShowResource |
|
|
|
|
ModuleAddress string `json:"module_address"` |
|
|
|
|
Change TerraformShowChangeSpec `json:"change"` |
|
|
|
|
ModuleAddress string `json:"module_address"` |
|
|
|
|
Change TerraformShowChangeSpec `json:"change"` |
|
|
|
|
HasCorrespondingResource bool |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type TerraformShowChangeSpec struct { |
|
|
|
@ -186,6 +187,7 @@ func TerraformPlanAndApply(
|
|
|
|
|
changedResource.Type = resourceWithValues.Type |
|
|
|
|
changedResource.Name = resourceWithValues.Name |
|
|
|
|
changedResource.Values = resourceWithValues.Values |
|
|
|
|
changedResource.HasCorrespondingResource = true |
|
|
|
|
} else { |
|
|
|
|
// TODO this can happen when a resource is deleted ( like an extra ssh key being deleted )
|
|
|
|
|
// for example:
|
|
|
|
@ -222,7 +224,7 @@ func TerraformPlanAndApply(
|
|
|
|
|
|
|
|
|
|
// json, err := json.MarshalIndent(simpleStatus, "", " ")
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// return nil, errors.Wrap(err, "can't GenerateTerraformPlan because can't json.Marshal the simpleStatus")
|
|
|
|
|
// return nil, nil, "", errors.Wrap(err, "can't GenerateTerraformPlan because can't json.Marshal the simpleStatus")
|
|
|
|
|
// }
|
|
|
|
|
// log.Println(string(json))
|
|
|
|
|
|
|
|
|
@ -699,10 +701,10 @@ func makeSimplifiedTerraformStatus(
|
|
|
|
|
|
|
|
|
|
resourceIndexRegexp := regexp.MustCompile(`\[([0-9]+)\]$`) |
|
|
|
|
for _, resourceChange := range tfShow.ResourceChanges { |
|
|
|
|
// resourceChange.Values should have come from the corresponding resource.
|
|
|
|
|
|
|
|
|
|
// if there is no corresponding resource, I think it should be nil and that means it was
|
|
|
|
|
// a deposed resource or something... lets omit it
|
|
|
|
|
if resourceChange.Values != nil { |
|
|
|
|
if !resourceChange.HasCorrespondingResource { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|