goformation
goformation copied to clipboard
Fix if implementation
Issue #, if available:
https://github.com/awslabs/goformation/issues/471
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
@rubenfonseca any chance that you will take a look on this? (Previous implementation of If with
switch v := ifEqual.(type) {
was written by my team member as well and merged to master but seems that it can be simplified
@rubenfonseca - unfortunately it won't be simple. I have my own fork of this repo where for some resources where I need to use parameter and then Intrinsics functions I can change type to string or interface{}. In this case I have to change
&apigateway.RestApi{
Name: "test",
Description: "test",
EndpointConfiguration: cloudformation.If("PrivateApiGateway",
apigateway.RestApi_EndpointConfiguration{
Types: cloudformation.Strings("PRIVATE"),
VpcEndpointIds: cloudformation.Strings(
cloudformation.Ref("ExecuteApiEndpointId"),
),
},
apigateway.RestApi.EndpointConfiguration from apigateway.RestApi_EndpointConfiguration to interface{} to be able to accept this if result. But still current if implementation is incorrect with current version I will get
ApiGateway:
Properties:
Name: "test"
Description: "test"
EndpointConfiguration: eyAiRm46OklmIiA6IFsgIlByaXZhdGVBcGlHYXRld2F5IiwgeyUhcSgqW11zdHJpbmc9JltQUklWQVRFXSkgJSFxKCpbXXN0cmluZz0mW2V5QWlVbVZtSWpvZ0lrVjRaV04xZEdWQmNHbEZibVJ3YjJsdWRFbGtJaUI5XSkgIiIgIiIgW10gbWFwW10gIiJ9LCB7JSFxKCpbXXN0cmluZz0mW0VER0VdKSAlIXEoKltdc3RyaW5nPTxuaWw+KSAiIiAiIiBbXSBtYXBbXSAiIn0gXSB9
After fix
ApiGateway:
Properties:
Name: "test"
Description: "test"
EndpointConfiguration:
Fn::If:
- PrivateApiGateway
- Types:
- PRIVATE
VpcEndpointIds:
- Ref: ExecuteApiEndpointId
- Types:
- EDGE
Thanks! Please give me some time so I can write a test in order for us to merge this.
Hi @rubenfonseca - any chance that you will take a look on this?
Thanks @xrn, merging it
:tada: This PR is included in version 6.7.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: