Skip to content

Commit 5076d31

Browse files
rakhul-mongooutcomes-winter-rakhulsprakashoarbusi
authored
feat: Add Federated Settings Identity Provider Resource (#1540)
Co-authored-by: Rakhul S Prakash <rakhul.s.prakash@peerislands.io> Co-authored-by: Oriol Arbusi Abadal <oriol.abadal@mongodb.com>
1 parent 18f8556 commit 5076d31

25 files changed

Lines changed: 1747 additions & 1 deletion

.github/workflows/contract-testing.yaml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
cluster-outage-simulation: ${{ steps.filter.outputs.cluster-outage-simulation }}
2121
federated-database-instance: ${{ steps.filter.outputs.federated-database-instance }}
2222
federated-query-limit: ${{ steps.filter.outputs.federated-query-limit }}
23+
federated-settings-identity-provider: ${{ steps.filter.outputs.federated-settings-identity-provider }}
2324
flex-cluster: ${{ steps.filter.outputs.flex-cluster }}
2425
online-archive: ${{ steps.filter.outputs.online-archive }}
2526
organization: ${{ steps.filter.outputs.organization }}
@@ -59,6 +60,8 @@ jobs:
5960
- 'cfn-resources/federated-database-instance/**'
6061
federated-query-limit:
6162
- 'cfn-resources/federated-query-limit/**'
63+
federated-settings-identity-provider:
64+
- 'cfn-resources/federated-settings-identity-provider/**'
6265
flex-cluster:
6366
- 'cfn-resources/flex-cluster/**'
6467
online-archive:
@@ -451,7 +454,50 @@ jobs:
451454
452455
cat inputs/inputs_1_create.json
453456
cat inputs/inputs_1_update.json
454-
457+
458+
make run-contract-testing
459+
make delete-test-resources
460+
461+
federated-settings-identity-provider:
462+
needs: change-detection
463+
if: ${{ needs.change-detection.outputs.federated-settings-identity-provider == 'true' }}
464+
runs-on: ubuntu-latest
465+
steps:
466+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
467+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5
468+
with:
469+
go-version-file: 'cfn-resources/go.mod'
470+
- name: setup Atlas CLI
471+
uses: mongodb/atlas-github-action@e3c9e0204659bafbb3b65e1eb1ee745cca0e9f3b
472+
- uses: aws-actions/setup-sam@c2a20b1822cc4a6bc594ff7f1dbb658758e383c3
473+
with:
474+
use-installer: true
475+
- uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708
476+
with:
477+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_TEST_ENV }}
478+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_TEST_ENV }}
479+
aws-region: eu-west-1
480+
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
481+
with:
482+
python-version: '3.9'
483+
cache: 'pip' # caching pip dependencies
484+
- run: pip install cloudformation-cli cloudformation-cli-go-plugin
485+
- name: Run the Contract test
486+
shell: bash
487+
env:
488+
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.CLOUD_DEV_PUBLIC_KEY }}
489+
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.CLOUD_DEV_PRIVATE_KEY }}
490+
MONGODB_ATLAS_ORG_ID: ${{ secrets.CLOUD_DEV_ORG_ID }}
491+
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }}
492+
MONGODB_ATLAS_PROFILE: cfn-cloud-dev-github-action
493+
MONGODB_ATLAS_FEDERATION_SETTINGS_ID: ${{ vars.MONGODB_ATLAS_FEDERATION_SETTINGS_ID }}
494+
run: |
495+
cd cfn-resources/federated-settings-identity-provider
496+
make create-test-resources
497+
498+
cat inputs/inputs_1_create.json
499+
cat inputs/inputs_1_update.json
500+
455501
make run-contract-testing
456502
make delete-test-resources
457503
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)