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

fix: Fix rpdk configs for new cloudformation cli versions #881

Merged
merged 10 commits into from
Feb 1, 2024
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ After the above 2 steps are completed and we've agreed on a path forward:
4. Commit and push your changes to your branch then submit a pull request against the current release branch, not master. The naming scheme of the branch is `release-staging-v#.#.#`. **Note**: There will only be one release branch at a time.
5. A repo maintainer will review the your pull request, and may either request additional changes or merge the pull request.

## Requirements

- Resources configurations, specifcally `.rpdk-config` and `Makefile` build commands, are compatible with cloudformation-cli (`cfn`) versions 0.2.34 and above.

## Testing
We have a `/test/README.md` for every resource in `cfn-resources`. You will also find [TESTING.md](./TESTING.md) which provides testing practices common to all resources. Please follow below guidelines for testing to ensure quality:

Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/access-list-api-key/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"typeName": "MongoDB::Atlas::AccessListAPIKey",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {
"version": false,
"subparser_name": null,
Expand Down
6 changes: 3 additions & 3 deletions cfn-resources/access-list-api-key/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ goos=linux
goarch=amd64
CFNREP_GIT_SHA?=$(shell git rev-parse HEAD)
ldXflags=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=info -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/access-list-api-key/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/alert-configuration/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"typeName": "MongoDB::Atlas::AlertConfiguration",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {
"version": false,
"subparser_name": null,
Expand Down
6 changes: 3 additions & 3 deletions cfn-resources/alert-configuration/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ goos=linux
goarch=amd64
CFNREP_GIT_SHA?=$(shell git rev-parse HEAD)
ldXflags=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=info -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}

Copy link
Member

Choose a reason for hiding this comment

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

not changed in this PR but in case you can do it here, all ldXflagsD (debug) must not have -s -w, an example would be:

ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}

Copy link
Member

Choose a reason for hiding this comment

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

thanks for suggestion, adjusted.

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
4 changes: 2 additions & 2 deletions cfn-resources/alert-configuration/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/api-key/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"typeName": "MongoDB::Atlas::APIKey",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {
"version": false,
"subparser_name": null,
Expand Down
6 changes: 3 additions & 3 deletions cfn-resources/api-key/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ goos=linux
goarch=amd64
CFNREP_GIT_SHA?=$(shell git rev-parse HEAD)
ldXflags=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=info -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/api-key/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
6 changes: 3 additions & 3 deletions cfn-resources/auditing/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"typeName": "MongoDB::Atlas::Auditing",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {
"version": false,
"subparser_name": null,
Expand All @@ -19,4 +19,4 @@
"protocolVersion": "2.0.0",
"pluginVersion": "2.0.4"
}
}
}
6 changes: 3 additions & 3 deletions cfn-resources/auditing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ goos=linux
goarch=amd64
CFNREP_GIT_SHA?=$(shell git rev-parse HEAD)
ldXflags=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=info -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-s -w -X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/auditing/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
6 changes: 3 additions & 3 deletions cfn-resources/autogen/templateMakeFile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ ldXflags=github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLo
ldXflagsD=github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug
build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="-s -w -X '$(ldXflags)'" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="-s -w -X '$(ldXflags)'" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="-s -w -X '$(ldXflagsD)'" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="-s -w -X '$(ldXflagsD)'" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
rm -rf bin
6 changes: 3 additions & 3 deletions cfn-resources/cloud-backup-restore-jobs/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"typeName": "MongoDB::Atlas::CloudBackUpRestoreJobs",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {
"importpath": "github.com/mongodb/mongodbatlas-cloudformation-resources/cloud-backup-restore-jobs",
"import_path": "github.com/mongodb/mongodbatlas-cloudformation-resources/cloud-backup-restore-jobs",
"protocolVersion": "2.0.0",
"pluginVersion": "2.0.4"
}
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-restore-jobs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defau

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-restore-jobs/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-schedule/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"typeName": "MongoDB::Atlas::CloudBackupSchedule",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {
"version": false,
"subparser_name": null,
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-schedule/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defau

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-schedule/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"typeName": "MongoDB::Atlas::CloudBackupSnapshotExportBucket",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {
"importpath": "github.com/mongodb/mongodbatlas-cloudformation-resources/cloud-backup-snapshot-export-bucket",
"import_path": "github.com/mongodb/mongodbatlas-cloudformation-resources/cloud-backup-snapshot-export-bucket",
"protocolVersion": "2.0.0",
"pluginVersion": "2.0.4"
}
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-snapshot-export-bucket/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defau

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-snapshot/.rpdk-config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"typeName": "MongoDB::Atlas::CloudBackupSnapshot",
"language": "go",
"runtime": "go1.x",
"entrypoint": "handler",
"testEntrypoint": "handler",
"entrypoint": "bootstrap",
"testEntrypoint": "bootstrap",
"settings": {

"import_path": "github.com/mongodb/mongodbatlas-cloudformation-resources/cloud-backup-snapshot",
Expand Down
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-snapshot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defau

build:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

debug:
cfn generate
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/handler cmd/main.go
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/bootstrap cmd/main.go

clean:
rm -rf bin
4 changes: 2 additions & 2 deletions cfn-resources/cloud-backup-snapshot/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Resources:
TypeFunction:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/

TestEntrypoint:
Type: AWS::Serverless::Function
Properties:
Handler: handler
Handler: bootstrap
Runtime: go1.x
CodeUri: bin/
Environment:
Expand Down
Loading
Loading