DependsOn Attribute
Is the DependsOn attribute on the road map or is it already supported some how?
Bump on this, any luck of getting this?
@tskinn FWIW I worked around this by extending the objects I needed "DependsOn" for. Not a great scale solution, but if there are a handful of objects you need this could help you out. I'm sure there is a more generic way of doing it as well, but only needed one object myself. Example code:
package main
import (
cfn "github.com/awslabs/goformation/cloudformation"
"encoding/json"
"fmt"
)
type AWSIAMPolicy struct {
cfn.AWSIAMPolicy
DependsOn []string
}
func (r *AWSIAMPolicy) MarshalJSON() ([]byte, error) {
type Properties cfn.AWSIAMPolicy
return json.Marshal(&struct {
Type string
Properties Properties
DependsOn []string
}{
Type: r.AWSIAMPolicy.AWSCloudFormationType(),
Properties: (Properties)(r.AWSIAMPolicy),
DependsOn: r.DependsOn,
})
}
func main() {
t := cfn.NewTemplate()
t.Resources["policys3" + resourceName] = &AWSIAMPolicy{
AWSIAMPolicy: cfn.AWSIAMPolicy{
Roles: []string{"role"},
PolicyName: "policy",
PolicyDocument: "policyDoc",
},
DependsOn: []string{"resource"},
}
j, err := t.JSON()
fmt.Printf("%s\n", string(j))
}
@PaulMaddox Can we close this as resolved via #132 now?
Any progress on this?
The DependsOn in CF Resources could be just a string, it does not need to be a list of strings. Should that be created as separated issue? thanks