diff --git a/Makefile b/Makefile index ab7b3c96..7ccd9b80 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,10 @@ test: go-build: go build -o $(APP_NAME) main.go +build-SSOSyncFunction: + GOOS=linux GOARCH=arm64 go build -o bootstrap main.go + cp ./bootstrap $(ARTIFACTS_DIR)/. + .PHONY: clean clean: rm -f $(OUTPUT) $(PACKAGED_TEMPLATE) diff --git a/cmd/root.go b/cmd/root.go index bb7113b3..a2911353 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -136,7 +136,7 @@ func Handler(ctx context.Context, event events.CodePipelineEvent) (string, error func init() { // init config cfg = config.New() - cfg.IsLambda = len(os.Getenv("_LAMBDA_SERVER_PORT")) > 0 + cfg.IsLambda = len(os.Getenv("AWS_LAMBDA_FUNCTION_NAME")) > 0 // initialize cobra cobra.OnInitialize(initConfig) diff --git a/template.yaml b/template.yaml index 54b53ab9..fe8b55e9 100644 --- a/template.yaml +++ b/template.yaml @@ -129,8 +129,10 @@ Resources: SSOSyncFunction: Type: AWS::Serverless::Function Properties: - Runtime: go1.x - Handler: dist/ssosync_linux_amd64_v1/ssosync + Runtime: provided.al2 + Handler: bootstrap + Architectures: + - arm64 Timeout: 300 Environment: Variables: @@ -185,6 +187,8 @@ Resources: Properties: Enabled: true Schedule: !Ref ScheduleExpression + Metadata: + BuildMethod: makefile AWSGoogleCredentialsSecret: Type: "AWS::SecretsManager::Secret"