From b6c7d976718c1e6872eff72addc5f3ae5208af0a Mon Sep 17 00:00:00 2001 From: Perkles Date: Sun, 5 May 2024 14:08:51 -0300 Subject: [PATCH] adiciona variaveis com referencias no template --- .github/workflows/main.yaml | 5 ++--- template.yaml | 35 +++++++++++++---------------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 613dc28..4821aee 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -25,10 +25,9 @@ jobs: with: role-to-assume: arn:aws:iam::175081627259:role/tech-challenge-oicd-githubactions aws-region: us-east-1 - # Build inside Docker containers + - run: sam build - # Prevent prompts and failure when the stack is unchanged - run: | sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --resolve-s3 \ --parameter-overrides \ - UserPoolId=${{ secrets.USERPOOLID }}, ClientId=${{ secrets.CLIENTID }} + UserPoolId=${{ secrets.USERPOOLID }} ClientId=${{ secrets.CLIENTID }} diff --git a/template.yaml b/template.yaml index f62ea01..a9ea130 100644 --- a/template.yaml +++ b/template.yaml @@ -3,44 +3,35 @@ Transform: AWS::Serverless-2016-10-31 Description: > tech-challenge-lambda - Função Lambda para autenticação de um usuário via CPF - FIAP Tech Challenge - -# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst + Função Lambda para autenticacao de um usuário via CPF - FIAP Tech Challenge + + Globals: Function: Timeout: 3 +Parameters: + UserPoolId: + Type: String + ClientId: + Type: String + Resources: AuthenticationFunction: - Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction + Type: AWS::Serverless::Function Properties: CodeUri: authenticate/ Handler: app.lambdaHandler Runtime: nodejs18.x - # Role: !GetAtt AuthenticationFunctionRole.Arn Architectures: - x86_64 Events: Authentication: - Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api + Type: Api Properties: Path: /authenticate Method: post Environment: Variables: - UserPoolId: "default-userpool-id" - ClientId: "default-client-id" - -# Outputs: -# # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function -# # Find out more about other implicit resources you can reference within SAM -# # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api -# AuthenticatonApi: -# Description: "API Gateway endpoint URL for Prod stage for Hello World function" -# Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" -# LabRoleFuncion: -# Description: "Hello World Lambda Function ARN" -# Value: !GetAtt LabRole.Arn -# LabRoleFuncionIamRole: -# Description: "Implicit IAM Role created for Hello World function" -# Value: !GetAtt LabRole.Arn \ No newline at end of file + UserPoolId: !Ref UserPoolId + ClientId: !Ref ClientId \ No newline at end of file