-
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
(aws-imagebuilder): "The value supplied for parameter 'distributions[0]' is not valid" deploying a distribution configuration #12882
Comments
@roebius thanks for reporting. Can you try a simple experiment for me? Can you try passing a list of strings for the Thanks, |
After checking the docs about escape hatches I tried to modify my code inserting overrides, but it didn't work.
And here is the result:
I also tried to instantiate the distribution configuration by directly passing: Let me know if you had in mind a different way to use the escape hatches. Thx. |
Can you try this? #!/usr/bin/env python3
from aws_cdk import core, aws_imagebuilder as imagebuilder
class DistrConfigStack(core.Stack):
def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
# Image distribution configuration
dist_rconfig = imagebuilder.CfnDistributionConfiguration(
self, 'DistrConfig',
name='DistrConfigTest',
distributions=[],
)
dist_rconfig.add_property_override('Distributions', ['eu-west-1', 'eu-central-1'])
app = core.App()
config_ami = DistrConfigStack(app, "Distrconfig", env=core.Environment(region='eu-west-1'))
app.synth() |
Did not work: here are the results from
Seeing the error expected type: JSONObject I looked at the CloudFormation format specifications here and here, then tried
I tried several other variations. The only one completing
but then in the resulting distribution configuration the distributions parameter is an empty list (seen with |
So it seems like this: Type: AWS::ImageBuilder::DistributionConfiguration
Properties:
Distributions:
- Region: eu-west-1
- Region: eu-central-1 is the correct shape for that property, and that imagebuilder.CfnDistributionConfiguration(
self,
'DistrConfig',
name='DistrConfigTest',
distributions=[
imagebuilder.CfnDistributionConfiguration.DistributionProperty(region='eu-west-1'),
imagebuilder.CfnDistributionConfiguration.DistributionProperty(region='eu-central-1')
]
) is the correct code... In this case, I'm pretty stumped 😕. This doesn't seem to be a CDK issue... Do you have premium support @roebius ? Can you open an issue to the team that owns ImageBuilder? |
It seems this works:
This is the same as the override that still gives the initial error but for each list element (a distribution) I added one of the optional parameters (I picked AmiDistributionConfiguration specifying just Name, didn't have time to test other options). This successfully deploys the distribution configuration. If I comment out the optional parameters the initial error shows up. As you indicate, this seems to be the corrrect code, at least when adding ami_distribution_configuration:
I do not have premium support so I guess I cannot open a case for this, but let me know. |
Huh 🤔. Then maybe Anyhow, glad you got yourself unblocked! Anything else we can help you with on this issue? |
I think that could be the case, anyway at the moment the issue for me is solved and I do not need additional support. |
|
Related: 26912 |
I have an EC2 Image Builder image pipeline stack that works fine when I deploy it without a distribution configuration.
When I add a distribution configuration the stack deployment fails during the distribution step.
Reproduction Steps
The following simplified stack, extracted from my complete pipeline stack, is reproducing the same issue:
What did you expect to happen?
My goal is to deploy an Image Builder pipeline stack that includes distribution of the EC2 image to a number of AWS regions.
What actually happened?
When I add the distribution configuration in my pipeline stack, however, the deployment fails.
When the stack deployment fails the following error is shown:
The value supplied for parameter 'distributions[0]' is not valid. One or more outputs should be provided for each region in a distribution configuration. (Service: Imagebuilder, Status Code: 400, Request ID: 7d5036b5-e982-476b-9694-5eab88737efe, Extended Request ID: null)
Environment
Other
In case it helps, this is the output of
cdk synth
:For CDK Image Builder I could not find any examples of image pipeline stacks including distributions: it would definitely help seeing one.
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: