-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v2' into dependabot/maven/v2/org.assertj-assertj-core-3…
….25.3
- Loading branch information
Showing
8 changed files
with
112 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Validate IaC | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- v2 | ||
pull_request: | ||
branches: | ||
- main | ||
- v2 | ||
paths: | ||
- 'examples/**' | ||
jobs: | ||
linter: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
project: ["sam", "gradle", "kotlin"] | ||
steps: | ||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
- name: Setup java JDK | ||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0 | ||
with: | ||
distribution: 'corretto' | ||
java-version: 11 | ||
- name: Build Project | ||
working-directory: . | ||
run: | | ||
mvn install -DskipTests | ||
- name: Run SAM validator to check syntax of IaC templates - Java | ||
working-directory: examples/powertools-examples-core-utilities//${{ matrix.project }} | ||
run: | | ||
sam build | ||
sam validate --lint | ||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 #v2.0.3 | ||
- name: Run Terraform validator to check syntax of IaC templates and produce a plan of changes | ||
working-directory: examples/powertools-examples-core-utilities/terraform | ||
run: | | ||
mvn install | ||
terraform -version | ||
terraform init -backend=false | ||
terraform validate | ||
- name: Setup Terraform lint | ||
uses: terraform-linters/setup-tflint@a5a1af8c6551fb10c53f1cd4ba62359f1973746f # v3.1.1 | ||
- name: Run Terraform lint to check for best practices, errors, deprecated syntax etc. | ||
working-directory: examples/powertools-examples-core-utilities/terraform | ||
run: | | ||
tflint --version | ||
tflint --init | ||
tflint -f compact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 0 additions & 48 deletions
48
examples/powertools-examples-core-utilities/cdk/infra/src/test/java/cdk/CdkStackTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +0,0 @@ | ||
/* | ||
* Copyright 2023 Amazon.com, Inc. or its affiliates. | ||
* Licensed under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package cdk; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.junit.jupiter.api.Test; | ||
import software.amazon.awscdk.App; | ||
import software.amazon.awscdk.assertions.Template; | ||
|
||
public class CdkStackTest { | ||
|
||
@Test | ||
public void testStack() { | ||
App app = new App(); | ||
CdkStack stack = new CdkStack(app, "test"); | ||
|
||
Template template = Template.fromStack(stack); | ||
|
||
// There should be 2 lambda functions, one to handle regular input, and another for streaming | ||
template.resourceCountIs("AWS::Lambda::Function", 2); | ||
|
||
// API Gateway should exist | ||
template.resourceCountIs("AWS::ApiGateway::RestApi", 1); | ||
|
||
// API Gateway should have a path pointing to the regular Lambda | ||
Map<String, String> resourceProperties = new HashMap<>(); | ||
resourceProperties.put("PathPart", "hello"); | ||
template.hasResourceProperties("AWS::ApiGateway::Resource", resourceProperties); | ||
|
||
// API Gateway should have a path pointing to the streaming Lambda | ||
resourceProperties = new HashMap<>(); | ||
resourceProperties.put("PathPart", "hellostream"); | ||
template.hasResourceProperties("AWS::ApiGateway::Resource", resourceProperties); | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters