-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
environmentVariables
property for GraphqlApi (#29064)
### Reason for this change AppSync now supports environment variables in GraphQL resolvers and functions. It would be good for `GraphqlApi` construct to have the property. - https://aws.amazon.com/jp/about-aws/whats-new/2024/02/aws-appsync-environment-variables-graph-ql-resolvers-functions/ - https://docs.aws.amazon.com/en_en/appsync/latest/devguide/environmental-variables.html - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-environmentvariables ### Description of changes The `environmentVariables` property is added to `GraphqlApi` construct. To add environment variables after the initiation, we can use `addEnvironmentVariables` method. ### Description of how you validated changes Both unit and integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"Resources": { | ||
"ApiF70053CD": { | ||
"Type": "AWS::AppSync::GraphQLApi", | ||
"Properties": { | ||
"AuthenticationType": "API_KEY", | ||
"EnvironmentVariables": { | ||
"EnvKey1": "non-empty-1", | ||
"EnvKey2": "non-empty-2" | ||
}, | ||
"Name": "Api" | ||
} | ||
}, | ||
"ApiSchema510EECD7": { | ||
"Type": "AWS::AppSync::GraphQLSchema", | ||
"Properties": { | ||
"ApiId": { | ||
"Fn::GetAtt": [ | ||
"ApiF70053CD", | ||
"ApiId" | ||
] | ||
}, | ||
"Definition": "type Test {\n id: String!\n name: String!\n}\ntype Query {\n getTests: [Test]!\n}\ntype Mutation {\n addTest(name: String!): Test\n}\n" | ||
} | ||
}, | ||
"ApiDefaultApiKeyF991C37B": { | ||
"Type": "AWS::AppSync::ApiKey", | ||
"Properties": { | ||
"ApiId": { | ||
"Fn::GetAtt": [ | ||
"ApiF70053CD", | ||
"ApiId" | ||
] | ||
} | ||
}, | ||
"DependsOn": [ | ||
"ApiSchema510EECD7" | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.