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

[certificate-manager] The certificate provided must be owned by the account creating the domain #9608

Closed
mainframenzo opened this issue Aug 11, 2020 · 3 comments
Assignees
Labels
@aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager @aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@mainframenzo
Copy link

mainframenzo commented Aug 11, 2020

I am running into this issue the first time a pipeline stage tries to deploy a stack in us-west-2 using both the 1.56 and 1.57 release: The certificate provided must be owned by the account creating the domain. I have tried using a newly created cert (shown below) and a manually created and validated cert (in us-east-1) with an ARN reference...both to no avail.

   const proxyLambda = new lambda.Function(this, 'LambdaAPIProxy', {
      code: lambda.Code.fromAsset(path.resolve(__dirname, '../../web_src/api')),
      handler: 'handler.index',
      runtime: lambda.Runtime.NODEJS_12_X
    });
    
    const api = new apigateway.LambdaRestApi(this, 'APIGateway', {
      description: 'API',
      handler: proxyLambda
    });

   //manually created hosted zone
   const hostedZone = route53.HostedZone.fromLookup(this, 'Zone', {
      domainName: 'domain.com'
    });

    const certificate = new certificateManager.DnsValidatedCertificate(this, 'DomainWildcardCertificate', {
      domainName: '*.domain.com',
      hostedZone: hostedZone,
      region: 'us-east-1'
    });

   //this is where the failure happens!
    const apiDomainName = api.addDomainName('CustomAPIDomainName', {
      domainName: 'api.domain.com',
      certificate: certificate,
      endpointType: apigateway.EndpointType.EDGE
    });

Does my issue have something to do with the API Gateway type, or that CloudFormation needs some sort of permission that the CDK isn't creating for me?

Originally posted by @mainframenzo in #9548 (comment)

@SomayaB SomayaB changed the title The certificate provided must be owned by the account creating the domain [certificate-manager] The certificate provided must be owned by the account creating the domain Aug 11, 2020
@SomayaB SomayaB added the bug This issue is a bug. label Aug 11, 2020
@github-actions github-actions bot added the @aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager label Aug 11, 2020
@SomayaB SomayaB added @aws-cdk/pipelines CDK Pipelines library @aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager needs-triage This issue or PR still needs to be triaged. and removed @aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager labels Aug 11, 2020
@njlynch
Copy link
Contributor

njlynch commented Aug 12, 2020

Thanks for the issue report, @mainframenzo .

I haven't been able to reproduce this behavior, either with the above as a stand-alone stack or as part of a CDK pipeline. The only thing I can think about might be a permissions issue somewhere; you may receive that error if the account doesn't have permissions to describe the certificate in the account. When you ran cdk bootstrap for the stage environment, did you use arn:aws:iam::aws:policy/AdministratorAccess as the CloudFormation execution policy, or something more restricted?

Is the account that owns the pipeline and the account for the first stage (where this fails) the same, or do you have multiple accounts throughout the pipeline? That shouldn't matter, but just trying to collect as much information as possible.

@njlynch njlynch added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 12, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Aug 12, 2020
@mainframenzo
Copy link
Author

@njlynch Ah ha! Derp. The issue was that I bootstrapped in only us-west-2. Because the cert needs to be created in us-east-1, I also needed to bootstrap there as well. Note if someone should have the same issue: I had to remove the CDK stack in us-west-2 before bootstrapping in both regions, otherwise I received the same error.

Maybe-not-useful-but-maybe-useful feature ask: if the cdk toolkit is aware of where its been bootstrapped, throw some sort of warning flag when referencing another region with no permissions? Cloudformation errors are so whack sometimes that debugging them feels like an Indiana Jones plot.

Thanks!

@birtles
Copy link

birtles commented Feb 15, 2021

I encountered this error in an app which previously only deployed to us-west-2 after I added a stack targetting us-east-1. I naively assumed I could use the same certificate for both.

The docs correctly indicate that certificates for regional API gateways need to be issued in the same region, but this error seemed to suggest the was a problem with the account not the region, and hence I spent a good few hours deleting stacks and redeploying everything before I realized the error message was wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager @aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants