-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AvailabilityZone is optional for Subnet #69
Conversation
Thanks for the submission, Adam! What do you think about adding an apply method with the old signature for backwards compatibility? You could add it as a deprecated method that we'd eventually remove, but that would keep it from being a breaking change. On a related note, looks like you missed the unit tests. They're not compiling. I'm thinking that even with the backwards compatibility change, it would be good to change those over to use Option. Or you could leave them an add additional tests for the Option method, and we'd then remove the non-Option versions if/when we remove the backwards compatibility apply(). |
Yep! I'll clean this up. I missed the unit tests. |
From my understanding, Scala only allows one apply method to have defaults arguments. This would require the new signature to explicitly define all the arguments. Do you think that's the right way forward? |
Ahh, you're right...I always forget that rule. I'd rather not lose the ability to have default arguments on the "new" signature. But that makes avoiding a breaking change a problem. Two approaches we could take:
@tj-corrigan any thoughts? |
This might not be the right forum for this question but I'm curious why you might be qualifying the AZ for the subnet? Are there other dependancies you have and need it specified? |
I'm fairly certain we are explicitly setting the AZ in order to maximize our usage of reserved instances which are tied to an AZ not a region. |
Also in general I would try to avoid breaking changes as much as we can. In this case though I'm guessing that people might normally be using the |
26c3233
to
f22683f
Compare
Let me know if this is what you're thinking in the builder section? I haven't added deprecation annotations yet. |
def withAZ(zone: Token[String])(f: (AZ) => Template): Template = f(AZ(zone)) // no resource to create | ||
case class AZ(zone: Option[Token[String]]) | ||
def withAZ(zone: Token[String])(f: (AZ) => Template): Template = f(AZ(Some(zone))) // no resource to create | ||
def withAZ(zone: Option[Token[String]])(f: (AZ) => Template): Template = f(AZ(zone)) // no resource to create | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to change this part. When we use withAZ
, we're definitely referencing an AZ.
f22683f
to
278938e
Compare
Doh! I've fixed it. |
Looks good by glancing. While it is a breaking change for people using the raw subnet object, it should be backwards compatible for people using |
This looks good. I dropped it into one of my main existing templates (where we use the builders) and it was backward compatible. Got a few more PRs to go through -- will cut a 3.2.0 release soon. |
AvailabilityZone is optional for Subnet
AWS CF Subnet Doc