-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
aws_appconfig, cdk.Fn.import_value: Error: Missing required parameters for environment ARN: format should be /$/{applicationId}/environment//$/{environmentId} #31580
Comments
Hi @vivekrpatel8 , thanks for reaching out. Not really clear of at which code you are getting the error but AFAIU, here is an AWS Doc which lists out the requirements for Fn:Import. Looks like you are implementing this as cross-stack reference, I tried to print the arn in first stack just to confirm what is the output value being printed which should be -/$/{applicationId}/environment//$/{environmentId} Could you please see if the first CfnOutput value corresponds to the format before import. |
@khushail Yeah exactly lets say I have two stacks... One stack is responsible for provisioning the infra for AppConfig such as creating application and environments. Other stack is a CodePipeline which adds and deploys HostedConfiguration for given app and environment. I tried to run cdk diff, but the output I get is not complete ARN but rather the components of ARN
|
@khushail My code looks something like this:
|
Hi @vivekrpatel8 , thanks for sharing the code. I used my above exported value in another stack and got the same error - AFAIU, this code here is checking the Arn during
which is invoking this code to check the resource name being imported -
public static fromEnvironmentArn(scope: Construct, id: string, environmentArn: string): IEnvironment {
const parsedArn = Stack.of(scope).splitArn(environmentArn, ArnFormat.SLASH_RESOURCE_NAME);
if (!parsedArn.resourceName) {
throw new Error(`Missing required /$/{applicationId}/environment//$/{environmentId} from environment ARN: ${parsedArn.resourceName}`);
Looks like the condition is triggering invocation of printed error message. let me investigate more and get back to you. |
Hello @khushail! Thanks for looking into it. I tried to mimic this ARN split logic in my python code and I believe the below code block is the throwing the mentioned error: I think the split logic is incorrect... So instead of using |
@vivekrpatel8 , yes you seem to be correct in identifying the block code.. i double checked the generated Synth template to see what is the output of the arn value - In the first stack , the output is - "Outputs": {
"EnvArn": {
"Value": {
"Fn::Join": [
"",
[
"arn:aws:appconfig:us-east-1:123456789012:application/",
{
"Ref": "MyApp3CE31C26"
},
"/environment/",
{
"Ref": "Environment78414C64"
}
]
]
},
"Export": {
"Name": "EnvArn"
}
} Since the 2nd stack which is importing this , is not getting synthesized, i am not sure how we could check into that imported value. So looks like, the error lies in the |
Marking this as P2 as it won't be immediately addressed by the team but would be on their radar. I will bring this up to the team for their input if this is something we are actively investigating and share our thoughts here if possible. |
Thanks for the update @khushail |
Requesting Core team's input on this issue as this is something being already addressed by the team or share insights on the debugging of issue. |
Describe the bug
I am creating environment for my AWS App Config using
I am using static method which returns the environment using ARN:
but getting following error:
@jsii/kernel.RuntimeError: Error: Missing required parameters for environment ARN: format should be /$/{applicationId}/environment//$/{environmentId}
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
It should return environment
Current Behavior
It is throwing error as mentioned
Reproduction Steps
Create environment and try to import it as mentioned in the description
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.154.1
Framework Version
No response
Node.js Version
20.0.0
OS
Windows
Language
Python
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: