-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[neptune] AssociatedRoles for CfnDBCluster #10224
Comments
This is being done as part of #10201. Closing this out as a duplicate. |
@njlynch so when is this going to be released? I see |
@namedgraph - This was released in 1.64.0 (released 2020-09-22). |
Thanks! |
@njlynch I'm getting circular reference error when attempting to assign an associated role to a Neptune cluster: Caused by: software.amazon.jsii.JsiiException: Resolution error: Resolution error: Unable to resolve object tree with circular reference. Path:
/Resources/${Token[CdkTestStack.NeptuneCluster.LogicalID.157]}/Properties/associatedRoles/0/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host/node/host.. What could be the problem? Role code: Role bulkLoaderRole = new Role(this, "RDFBulkLoaderRole", RoleProps.builder().
assumedBy(new ServicePrincipal("rds.amazonaws.com")).
build());
bulkLoaderRole.addToPolicy(PolicyStatement.Builder.create().
effect(Effect.ALLOW).
actions(Arrays.asList("s3:Get*", "s3:List*")).
resources(Arrays.asList("*")).
build()); Cluster code:
|
That repeating '/node/host/node/host' is certainly suspect. I'm not seeing anything from your code above. I suspect the issue lies somewhere in the translation from |
The only related code that I can see is the following -- which I commented out, but still get the same error: // String neptuneHost = Token.asString("https://" + neptune.getAttrEndpoint() + ":" + neptune.getAttrPort());
Function bulkLoader = bulkLoader(vpc, neptuneSg);
// bulkLoader.addEnvironment("ENDPOINT_URI", neptuneHost).
// addEnvironment("FORMAT", "ntriples").
// addEnvironment("IAM_ROLE_ARN", bulkLoaderRole.getRoleArn()).
// addEnvironment("REGION", getRegion()); |
I can try to make a minimal case if that helps. So far the only way to get rid of the error is to remove the |
Sure, a minimal case would be useful. |
@njlynch here you go: https://github.com/namedgraph/neptune-cdk-test/blob/master/src/main/java/com/myorg/NeptuneCdkTestStack.java I hope it's enough to demonstrate the problem (running |
@njlynch can you confirm? |
Ah, I see it now. tl;dr - Here's the fix to your code: CfnDBCluster.DBClusterRoleProperty clusterRole = new CfnDBCluster.DBClusterRoleProperty.Builder().
roleArn(associatedRole.getRoleArn()).
build();
return CfnDBCluster.Builder.create(this, "NeptuneCluster").
// ...
associatedRoles(Arrays.asList(clusterRole)).
// ...
.build(); The associated roles isn't just an IAM Role, it's a specific type expected by CloudFormation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-associatedroles The Java docs are not helpful here, showing the type of associatedRoles as If you look at the Typescript or Python docs, you'll see slightly more helpful types:
I am really intrigued by the bad error message you got, and by the poor Java docs in this example. I'll follow up on our jsii project -- responsible for both -- and see if we can't make some improvements. Either way, hopefully this gets you up and running now. |
This is type-union-induced, hence this RFC is relevant: aws/aws-cdk-rfcs#193 |
I'm closing this out, as it seems to be resolved; feel free to comment/re-open if you have any other follow-ups. The fixes to the messaging and docs are being tracked as part of the above RFC. |
|
AssociatedRoles
is now supported by CF templates for Amazon Neptune, but not available in the CDK (as of v1.62.0).Use Case
Associating an IAM role with a Neptune's
CfnDBCluster
.Proposed Solution
Should be possible as
AssociatedRoles
is available for other types ofDBCluster
.Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: