Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Add support for Conditions on Resources #224

Closed
smithhannahm opened this issue Sep 13, 2019 · 0 comments
Closed

Add support for Conditions on Resources #224

smithhannahm opened this issue Sep 13, 2019 · 0 comments

Comments

@smithhannahm
Copy link

smithhannahm commented Sep 13, 2019

Could a similar fix to #132 be implemented to associate Conditions with Resources? I tried a workaround to extend individual resources, like so:

type AWSEC2EIP struct {
	resources.AWSEC2EIP
	Condition string
}

func (r *AWSEC2EIP) MarshalJSON() ([]byte, error) {
	type Properties resources.AWSEC2EIP
	return json.Marshal(&struct {
		Type       string
		Properties Properties
		Condition  string
	}{
		Type:       r.AWSEC2EIP.AWSCloudFormationType(),
		Properties: (Properties)(r.AWSEC2EIP),
		Condition:  r.Condition,
	})
}

But some of the default processing on "Condition" nodes cause resources generated by this workaround to evaluate to 'false', which is not valid CloudFormation.

Resources:
    MyEIP: false
smithhannahm added a commit to smithhannahm/goformation that referenced this issue Sep 16, 2019
Allow users to set conditions on resources

Fix awslabs#224
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants