Agree with both statements. If there was documentation about this on createSecurityGroup I'd knew instantly what is going on. It could even be a generic statement that a certain method adheres to GroupNamingConvention.
The pattern does not really match my use case because I create a single security group on first run and then re-use it for each new VM (that's why I hardcoded the name). I'd probably have to save the name to database in this case and I think that's what I'll actually do. On 19. 03. 2016 17:58, Andrew Phillips wrote: >>> Regarding the group name in the nodes, could you share the code you >>> use to build the template, including the template options? > > Thanks for the additional details! More information on the resource > prefixing Ignasi was mentioning is here, by the way: > > http://jclouds.apache.org/reference/javadoc/1.9.x/org/jclouds/compute/functions/GroupNamingConvention.html > > > Still, it seems we are short on documentation on where exactly this > prefixing is applied. For example, the documentation for > createSecurityGroup [1] does not mention this, even though from the code > [2] and what we've seen in this thread a prefix *is* being added. > > In order to avoid this problem, would it make sense to recommend the > following pattern? > > SecurityGroup sg = securityGroupExtension.createSecurityGroup("name", > region); > > // get the name of the actually created item!! > String sgName = sg.getName(); > ... > EC2TemplateOptions o = EC2TemplateOptions.Builder.securityGroups(sgName); > ... > > In other words, instead of assuming that the input parameter to > createSecurityGroup (or similar calls) can be used as-is, always use the > values of the resulting object? > > Regards > > ap > > [1] > http://jclouds.apache.org/reference/javadoc/1.9.x/org/jclouds/aws/ec2/compute/extensions/AWSEC2SecurityGroupExtension.html#createSecurityGroup(java.lang.String, > java.lang.String) > [2] > https://github.com/jclouds/jclouds/blob/master/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2SecurityGroupExtension.java#L73 >
