sparkleformation / sfn

SparkleFormation CLI
http://www.sparkleformation.io
Apache License 2.0
63 stars 24 forks source link

Ambiguity around v1 / v2 calls to LoadBalancer resource #277

Closed ghost closed 6 years ago

ghost commented 6 years ago

sfn version: 3.0.30

When running a simple dynamic call to cloudformation's load balancer resource, I get back an error about cfn not being able to decide which API version to use. This definitely looks like a subtle change in behavior on the AWS end, but I'm also having a hard time specifying things as a string or trying to specify which resource to call. Would love your insights there, thanks!

Code:

dynamic!(:load_balancer, :foobar) do
  # ...
end

Error:

ERROR: ArgumentError: Ambiguous dynamic name returned multiple matches! `:load_balancer` -> AWS::ElasticLoadBalancing::LoadBalancer, AWS::ElasticLoadBalancingV2::LoadBalancer
ghost commented 6 years ago

Aha! I think I found what I need in order to specify this unambiguously:

http://www.sparkleformation.io/docs/sparkle_formation/building-blocks.html#builtin-lookup-behavior

"When the lookup is performed, this will match the AWS::EC2::Instance resource. This may not be the correct match, however, since there is also an AWS::OpsWorks::Instance resource type. The correct lookup can be forced (if the OpsWorks resource is the desired resource) by providing the namespace prefix:"

SparkleFormation.new(:with_namespace) do
  dynamic!(:opsworks_instance, :foobar)
end

Thanks for the excellent documentation @chrisroberts

ghost commented 6 years ago

so my call became:

dynamic!(:elastic_load_balancing_load_balancer, :foobar) do
  # ...
end