Open smcroskey opened 2 years ago
Based on the above, I was able to work around this issue by deriving from StateMachine and overriding the stateMachineArn
property like this:
export class StateMachine extends sfn.StateMachine {
constructor(scope: Construct, id: string, props: StateMachineProps) {
super(scope, id, props);
// @ts-ignore
this.stateMachineArn = this.getResourceArnAttribute(
(this.node.defaultChild as CfnStateMachine).attrArn,
{
service: 'states',
resource: 'stateMachine',
resourceName: this.physicalName,
arnFormat: ArnFormat.COLON_RESOURCE_NAME,
}
)
}
}
(basically just replacing the resource attribute here from ref
to attrArn
)
Wow, nice detective work here!
I don't know about the specifics that are at play here, but it feels like this could be a difference between CloudFormation and the AWS CloudControl API with the latter not returning a ref attribute while CloudFormation seems to support this. But that is something that should be confirmed first.
We could however, add a special case for state machines and switch from Ref to Arn in this case. The current implementation for resources that are supported by the AWS CC API just passes along, whatever was called.
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.
Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen.
Is there any workaround for this issue when you are using a construct that is out of our control has this kind of issue? We're using a construct that defines an S3 bucket and S3 bucket policy and the same kind of .ref
reference:
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L2007
I wonder if this can be solved by simply adding ref
as an attribute to the bucket resource: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket#attribute-reference
I have a simple state machine using the AWS CDK adapter with cdktf where I am trying to use nested workflows via the
StepFunctionsStartExecution
optimized integration.However, the cdktf JSON output doesn't appear to be valid because the reference to the child state machine uses a
Ref
attribute that doesn't exist (modified the TF json output slightly to make it more readable, but the key is the"Ref"
attribute in theStateMachineArn
field value for theManual Review
state):If I try to deploy, it complains about a missing
Ref
attribute. Note that if I change theRef
above toArn
and deploy, it deploys successfully. It seems that the StateMachine mapping for the AWS CDK adapter must not be including theRef
attribute?