Skip to content
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

CDK fails to deploy SCP without a description #1613

Open
hertzsprung opened this issue May 10, 2024 · 0 comments
Open

CDK fails to deploy SCP without a description #1613

hertzsprung opened this issue May 10, 2024 · 0 comments

Comments

@hertzsprung
Copy link

hertzsprung commented May 10, 2024

Trying to CDK deploy a Service Control Policy without a description gives an error "You must provide a value for the parameter." An SCP description is documented as "Required: Yes" but also "optional" at the same time. Presumably cdk-organizations needs to replace a null description value with an empty string?

For example (in Java):

Organization organization = Organization.Builder.create(this, "Organization").build();

Policy accountBaselineSCP = Policy.Builder.create(this, "AccountBaseline")
        .policyType(PolicyType.SERVICE_CONTROL_POLICY)
        .policyName("AccountBaseline")
        .content("""
                      {
                      "Version": "2012-10-17",
                      "Statement": [
                        {
                          "Effect": "Deny",
                          "Action": [
                            "organization:*",
                            "account:*"
                          ],
                          "Resource": "*"
                        }
                      ]
                    }""")
        //.description("Deny changes to baseline account configuration") // TODO: uncomment to allow CDK deploy to succeed
        .build();
organization.getRoot().attachPolicy(accountBaselineSCP);

Fairly sure we need to modify policy.ts to use Description: description ?? "" instead of Description: description, but I'll test locally before raising an MR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant