Skip to content

Commit 05ad5dd

Browse files
feat: Add Federated Settings Identity Provider Resource
1 parent 600f5ba commit 05ad5dd

25 files changed

Lines changed: 1767 additions & 1 deletion

.github/workflows/contract-testing.yaml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
cluster-outage-simulation: ${{ steps.filter.outputs.cluster-outage-simulation }}
2020
federated-database-instance: ${{ steps.filter.outputs.federated-database-instance }}
2121
federated-query-limit: ${{ steps.filter.outputs.federated-query-limit }}
22+
federated-settings-identity-provider: ${{ steps.filter.outputs.federated-settings-identity-provider }}
2223
flex-cluster: ${{ steps.filter.outputs.flex-cluster }}
2324
online-archive: ${{ steps.filter.outputs.online-archive }}
2425
organization: ${{ steps.filter.outputs.organization }}
@@ -54,6 +55,8 @@ jobs:
5455
- 'cfn-resources/federated-database-instance/**'
5556
federated-query-limit:
5657
- 'cfn-resources/federated-query-limit/**'
58+
federated-settings-identity-provider:
59+
- 'cfn-resources/federated-settings-identity-provider/**'
5760
flex-cluster:
5861
- 'cfn-resources/flex-cluster/**'
5962
online-archive:
@@ -401,7 +404,50 @@ jobs:
401404
402405
cat inputs/inputs_1_create.json
403406
cat inputs/inputs_1_update.json
404-
407+
408+
make run-contract-testing
409+
make delete-test-resources
410+
411+
federated-settings-identity-provider:
412+
needs: change-detection
413+
if: ${{ needs.change-detection.outputs.federated-settings-identity-provider == 'true' }}
414+
runs-on: ubuntu-latest
415+
steps:
416+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
417+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5
418+
with:
419+
go-version-file: 'cfn-resources/go.mod'
420+
- name: setup Atlas CLI
421+
uses: mongodb/atlas-github-action@e3c9e0204659bafbb3b65e1eb1ee745cca0e9f3b
422+
- uses: aws-actions/setup-sam@c2a20b1822cc4a6bc594ff7f1dbb658758e383c3
423+
with:
424+
use-installer: true
425+
- uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708
426+
with:
427+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_TEST_ENV }}
428+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_TEST_ENV }}
429+
aws-region: eu-west-1
430+
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
431+
with:
432+
python-version: '3.9'
433+
cache: 'pip' # caching pip dependencies
434+
- run: pip install cloudformation-cli cloudformation-cli-go-plugin
435+
- name: Run the Contract test
436+
shell: bash
437+
env:
438+
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.CLOUD_DEV_PUBLIC_KEY }}
439+
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.CLOUD_DEV_PRIVATE_KEY }}
440+
MONGODB_ATLAS_ORG_ID: ${{ secrets.CLOUD_DEV_ORG_ID }}
441+
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }}
442+
MONGODB_ATLAS_PROFILE: cfn-cloud-dev-github-action
443+
MONGODB_ATLAS_FEDERATION_SETTINGS_ID: ${{ vars.MONGODB_ATLAS_FEDERATION_SETTINGS_ID }}
444+
run: |
445+
cd cfn-resources/federated-settings-identity-provider
446+
make create-test-resources
447+
448+
cat inputs/inputs_1_create.json
449+
cat inputs/inputs_1_update.json
450+
405451
make run-contract-testing
406452
make delete-test-resources
407453
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"typeName": "MongoDB::Atlas::FederatedSettingsIdentityProvider",
3+
"language": "go",
4+
"runtime": "provided.al2",
5+
"entrypoint": "bootstrap",
6+
"testEntrypoint": "bootstrap",
7+
"settings": {
8+
"import_path": "github.com/mongodb/mongodbatlas-cloudformation-resources/federated-settings-identity-provider",
9+
"protocolVersion": "2.0.0",
10+
"pluginVersion": "2.0.4"
11+
}
12+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.PHONY: build test clean
2+
tags=logging callback metrics scheduler
3+
cgo=0
4+
goos=linux
5+
goarch=amd64
6+
CFNREP_GIT_SHA?=$(shell git rev-parse HEAD)
7+
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}
8+
ldXflagsD=-X github.com/mongodb/mongodbatlas-cloudformation-resources/util.defaultLogLevel=debug -X github.com/mongodb/mongodbatlas-cloudformation-resources/version.Version=${CFNREP_GIT_SHA}
9+
10+
build:
11+
cfn generate
12+
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflags)" -tags="$(tags)" -o bin/bootstrap cmd/main.go
13+
14+
debug:
15+
cfn generate
16+
env GOOS=$(goos) CGO_ENABLED=$(cgo) GOARCH=$(goarch) go build -ldflags="$(ldXflagsD)" -tags="$(tags)" -o bin/debug cmd/main.go
17+
18+
clean:
19+
rm -rf bin
20+
21+
submit: clean build # submit to private registry must use release build not debug build
22+
@echo "==> Submitting to private registry for testing"
23+
cfn submit --set-default --region us-east-1
24+
25+
create-test-resources:
26+
@echo "==> Creating test files and resources for contract testing"
27+
./test/contract-testing/cfn-test-create.sh
28+
29+
delete-test-resources:
30+
@echo "==> Delete test resources used for contract testing"
31+
./test/contract-testing/cfn-test-delete.sh
32+
33+
run-contract-testing:
34+
@echo "==> Run contract testing"
35+
make build
36+
sam local start-lambda &
37+
cfn test --function-name TestEntrypoint --verbose
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# MongoDB::Atlas::FederatedSettingsIdentityProvider
2+
3+
## Description
4+
5+
The federated settings identity provider resource provides access to your Atlas
6+
federated authentication identity providers (SAML and OIDC). It lets you
7+
create, edit, and delete identity providers within an Atlas federation.
8+
9+
## Requirements
10+
11+
To securely give CloudFormation access to your Atlas credentials, you must
12+
set up an [AWS Profile](/README.md#mongodb-atlas-api-keys-credential-management).
13+
14+
## Attributes and Parameters
15+
16+
See the [resource docs](docs/README.md).
17+
18+
## Cloudformation Examples
19+
20+
Examples for this resource will be added in `/examples/`.
21+
22+
## Contract Testing
23+
24+
Contract testing requires a valid Federation Settings ID
25+
export MONGODB_ATLAS_FEDERATION_SETTINGS_ID="your-federation-settings-id"
26+
27+
# Run contract tests
28+
29+
make create-test-resources
30+
cfn test -- -k contract_create_delete
31+
make delete-test-resources

cfn-resources/federated-settings-identity-provider/cmd/main.go

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cfn-resources/federated-settings-identity-provider/cmd/resource/config.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)