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

feat(appsync): expose the AppSyncDomain of the custom domain of an AppSync api #21554

Merged
merged 4 commits into from
Aug 11, 2022

Conversation

AKoetsier
Copy link
Contributor

When configuring a custom domain on an AppSync api you couldn't easily get the AppSyncDomainName attribute of the associated AWS::AppSync::DomainName. This fix will expose that attribute so that the provided example doesn't throw errors.

All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Aug 11, 2022

@github-actions github-actions bot added the p2 label Aug 11, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team August 11, 2022 12:00
Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Let's make the name a bit more user friendly please.

And out of curiosity, what is the difference between appSyncDomainName and the provided domain (myDomainName in the example)?

packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts Outdated Show resolved Hide resolved
@mrgrain mrgrain changed the title fix(appsync): expose the AppSyncDomain of the custom domain of an AppSync api feat(appsync): expose the AppSyncDomain of the custom domain of an AppSync api Aug 11, 2022
@mrgrain
Copy link
Contributor

mrgrain commented Aug 11, 2022

Additionally, please make sure the build is passing. You can see the latest build failure here: #21554 (comment)

tl;dr Your change to the example is not compiling.

@AKoetsier
Copy link
Contributor Author

And out of curiosity, what is the difference between appSyncDomainName and the provided domain (myDomainName in the example)?

The myDomainName in the example is just the string 'api.example.com'. So the example would create a CNAME with the name api.example.com with a value api.example.com. The appSyncDomainName is the cloudfront url of the newly associated custom domain.

@mergify mergify bot dismissed mrgrain’s stale review August 11, 2022 13:44

Pull request has been modified.

@mrgrain mrgrain added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Aug 11, 2022
Comment on lines 473 to 479
/**
* the associated custom AppSync domain, if present
*
* @default - no custom associated domain
*/
public readonly appSyncDomainName?: string;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* the associated custom AppSync domain, if present
*
* @default - no custom associated domain
*/
public readonly appSyncDomainName?: string;
/**
* The associated domain name provided by AppSync
*/
public readonly appSyncDomainName: string;

domainName.attrAppSyncDomainName seems to be always available. Is there a reason why you made this optional at first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The domainName resource is only created when you pass the domainName properties in the api. So when creating a minimal api it will not create an AWS::AppSync::DomainName or an AWS::AppSync::DomainNameApiAssociation and therefore you don't have the appSyncDomainName.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay that makes sense. let's update the comment then to make this clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I only just saw this comment appear. I have changed it a bit to be even more clear when you are requesting the appSyncDomainName without a domainName configuration.

@mergify mergify bot dismissed mrgrain’s stale review August 11, 2022 16:04

Pull request has been modified.

@AKoetsier
Copy link
Contributor Author

I converted the attribute to a getter function so that we can throw an error when no domainName is configured. This is more inline with other modules and makes it easier to use.

@mrgrain
Copy link
Contributor

mrgrain commented Aug 11, 2022

I converted the attribute to a getter function so that we can throw an error when no domainName is configured. This is more inline with other modules and makes it easier to use.

Thanks! I was about to comment about that. 😄

Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good now. Ready to ship if the build passes. 🎉

@mergify
Copy link
Contributor

mergify bot commented Aug 11, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: e91882e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit d1097b5 into aws:main Aug 11, 2022
@mergify
Copy link
Contributor

mergify bot commented Aug 11, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@AKoetsier AKoetsier deleted the feature/expose-apssync-custom-domain branch August 12, 2022 06:16
@mrgrain mrgrain added the effort/small Small work item – less than a day of effort label Aug 17, 2022
josephedward pushed a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
…pSync api (aws#21554)

When configuring a custom domain on an AppSync api you couldn't easily get the AppSyncDomainName attribute of the associated AWS::AppSync::DomainName. This fix will expose that attribute so that the provided example doesn't throw errors.

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants