Skip to content

Commit

Permalink
Import project from michelin src
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Laribiere committed Nov 30, 2023
1 parent 62afac1 commit 93544c4
Show file tree
Hide file tree
Showing 37 changed files with 3,198 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
go.sum
terraform.tfstate
*.backup
*.exe
example/.terraform.tfstate.lock.info
build/**
example/terraform.tfvars
test/usecase/terraform.tfvars
test/usecase/.terraformrc
test/usecase/.terraform
test/usecase/.terraform.lock.hcl
test/usecase/terraform.hcl
test/usecase1/.terraform
test/usecase1/.terraform.lock.hcl
test/usecase1/terraform.tfvars
test/usecase2/.terraform
test/usecase2/.terraform.lock.hcl
test/usecase2/terraform.tfvars
test/usecase3/.terraform
test/usecase3/.terraform.lock.hcl
test/usecase3/terraform.tfvars
test/usecase4/.terraform
test/usecase4/.terraform.lock.hcl
test/usecase4/terraform.tfvars
test/.terraformrc
*.hcl
test/terraform-loc.tfstate
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Terraform Provider",
"type": "go",
"request": "launch",
"mode": "debug",
// this assumes your workspace is the root of the repo
"program": "${workspaceFolder}",
"env": {},
"args": [
"-debug",

]
}
]
}
11 changes: 11 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Code of Conduct
We want our project to be a welcoming and inclusive community for everyone. This code of conduct outlines our expectations for all contributors, as well as the consequences for unacceptable behavior.

Our Standards
We expect all contributors to:

Be respectful and considerate towards others, regardless of their background, identity, or opinions.
Refrain from any form of harassment, discrimination, or hate speech.
Maintain a professional and respectful demeanor in all interactions within the project, including online and in person.
Be open to constructive feedback and willing to learn from others.
Respect the privacy of other contributors and users of the project.
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing to Terraform provider Forgerock

Welcome and thank you for considering contributing to Terraform provider Forgerock!

By following these guidelines, you can help make the contribution process easy and effective for everyone involved. It
also shows that you agree to respect the time of the developers managing and developing these open source projects. In
return, we will reciprocate that respect by addressing your issue, assessing changes, and helping you finalize your pull
requests.

## Getting Started

### Issues

Issues should be used to report problems, request a new feature, or to discuss potential changes before a PR is created.
When you create a new Issue, a template will be loaded that will guide you through collecting and providing the
information we need to investigate.

If you find an existing issue that addresses the problem you're having, please add your own reproduction information to
the existing issue instead of creating a new one. Adding
a [reaction](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) can also indicate to
our maintainers that a particular problem is affecting more than just the reporter.

If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and a clear
description, relevant information, and a code sample or executable test case demonstrating the expected behavior that is
not occurring.

### Pull Requests

PRs are always welcome and can be a quick way to get your fix or improvement slated for the next release. In general,
PRs should:

- Only fix/add the functionality in question OR address wide-spread style issues, not both.
- Add unit or integration tests for fixed or changed functionality (if a test suite already exists).
- Address a single concern in the least number of changed lines as possible.
- Be accompanied by a complete Pull Request template (loaded automatically when a PR is created).

Be sure to use the past tense ("Added new feature...", "Fixed bug on...") and add tags to the PR ("documentation" for
documentation updates, "bug" for bug fixing, etc.).

For changes that address core functionality or would require breaking changes (e.g. a major release), it's best to open
an Issue to discuss your proposal first. This is not required but can save time creating and reviewing changes.

In general, we follow the ["fork-and-pull" Git workflow](https://github.com/susam/gitpr)

- Fork the repository to your own Github account
- Clone the project to your machine
- Create a branch locally from master with a succinct but descriptive name
- Commit changes to the branch
- Following any formatting and testing guidelines specific to this repo
- Push changes to your fork
- Open a PR in our repository targeting master and follow the PR template so that we can efficiently review the changes.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright [2024] [MICHELIN]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
147 changes: 146 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,146 @@
# terraform-provider-forgerock
# Terraform-provider-forgerock

[![GitHub Build](https://img.shields.io/github/actions/workflow/status/michelin/terraform-provider-forgerock/on_push_master.yml?branch=master&logo=github&style=for-the-badge)](https://img.shields.io/github/actions/workflow/status/michelin/terraform-provider-forgerock/on_push_master.yml)
[![GitHub release](https://img.shields.io/github/v/release/michelin/terraform-provider-forgerock?logo=github&style=for-the-badge)](https://github.com/michelin/terraform-provider-forgerock/releases)
[![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/michelin/terraform-provider-forgerock/latest?logo=github&style=for-the-badge)](https://github.com/michelin/terraform-provider-forgerock/commits/main)
[![GitHub Stars](https://img.shields.io/github/stars/michelin/terraform-provider-forgerock?logo=github&style=for-the-badge)](https://github.com/michelin/terraform-provider-forgerock)
[![GitHub Watch](https://img.shields.io/github/watchers/michelin/terraform-provider-forgerock?logo=github&style=for-the-badge)](https://github.com/michelin/terraform-provider-forgerock)
[![SonarCloud Coverage](https://img.shields.io/sonar/coverage/michelin_terraform-provider-forgerock?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge)](https://sonarcloud.io/component_measures?id=michelin_terraform-provider-forgerock&metric=coverage&view=list)
[![SonarCloud Tests](https://img.shields.io/sonar/tests/michelin_terraform-provider-forgerock/master?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarcloud)](https://sonarcloud.io/component_measures?metric=tests&view=list&id=michelin_kstreamplify)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=apache&style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)

terraform-provider-forgerock introduces Forgerock OAuth2 client creation functionality to terraform.

## Table of Contents

* [Principles](#principles)
* [Local run](#local-run)
* [Build project](#build-project)
* [Provider configuration](#provider-configuration)
* [Resource configuration](#resource-configuration)
* [Public client (Front to Back)](#public-client-front-to-back)
* [Private client (Back to Back)](#private-client-back-to-back)
* [Resource complet field list](#resource-complet-field-list)
* [Example](#example)
* [Contribution](#contribution)

## Principles

Terraform-provider-forgerock is a terraform provider that allows you to create Forgerock OAuth2 clients through ForgeRock APIs.

## Local run

To start the provider in debug mode, you can use Visual Studio Code:

* Navigate to the `/example` directory.
* Create a `terraform.tfvars` file (do not track in Git) and fill it out.
* Press F5.
* Execute the command provided in the console after the provider starts.

## Build project

To build your project run these commands:

```bash
go mod tidy
go build
```

## Provider configuration

To configure the provider you need to add the following code to your terraform file:

```hcl
terraform {
required_providers {
forgerock = {
source = "michelin/forgerock"
}
}
}
provider "forgerock" {
username = var.username
password = var.password
forgerock_api = var.forgerock_api
realm_path = var.realm_path
mail_sender = {
send_client_secret_mail = true
smtp_server = "smtp.example.com"
smtp_port = 587
sender_email = "[email protected]"
sender_username = "username"
sender_password = "password"
}
}
```

## Resource configuration

We provide a set of default configurations for several types of clients:

* Public client (authentication code flow)
* Private client (client secret)

### Public client (code flow)

```hcl
resource "forgerock_oauth2Client" "myPublicClient" {
name = "my_public_client"
admin_mail = "[email protected]"
advanced_oauth2_client_config = {
token_endpoint_auth_method = "none"
grant_types = ["authorization_code", "refresh_token"]
is_consent_implied = true
}
core_open_id_client_config = {
post_logout_redirect_uri = ["http://localhost:4200"]
}
core_oauth2_client_config = {
status = "Active"
scopes = ["profile", "email", "openid"]
redirection_uris = ["http://localhost:4200", "https://anotherurl.com"]
client_type = "Public"
}
}
```

### Private client (client secret)

```hcl
resource "forgerock_oauth2Client" "myPrivateClient" {
name = "my_private_client"
admin_mail = "[email protected]"
user_password_version = 0
advanced_oauth2_client_config = {
token_endpoint_auth_method = "none"
grant_types = ["client_credentials"]
is_consent_implied = true
}
core_open_id_client_config = {
post_logout_redirect_uri = [""]
}
core_oauth2_client_config = {
status = "Active"
scopes = ["profile", "email", "openid"]
redirection_uris = [""]
client_type = "Confidential"
}
}
```

### Example

You can find a complete example [here](./example/main.tf)

### Resource complete field list

If you want to customize the default configuration given above you can refer to the following [documentation](./docs/fields_list.md)
Loading

0 comments on commit 93544c4

Please sign in to comment.