This page is for Authlete 2.x. For current (3.0) documentation, see this page.
Managing the stack
Having a Terraform project for managing just the Service and another one for Clients might not be the best solution in all cases. In some cases, your CI/CD pipeline will be simpler if you group the service definition and required clients in a single Terraform module. In this sample we will demo how grouping the objects with conjunction of workspace can be used to organize the workflow of the change management process.Declaring the stack objects
The services and clients objects dependent but they are not required be declared in different projects or modules. That will be required only if you need to bootstrap the project from an existing Authlete configuration, see more detail in Bootstraping project from configuration. If you have seen the service and client management notes, you might have already noticed how you can declare the services and the clients in a single module, but the source code is available understack_management folder of
Authlete Terraform Samples.
We start the example by declaring the required provider under provider.tf and initializing the workspace. You can follow
the steps for that in the section Declaring the dependency on Creating a project from scratch.
The Authlete Service and Client can be found in the main.tf source code shown below. The authlete_service resource
declares a service as and the authlete_client resource declares an OAuth client dependent on the as service via
service_api_key and service_api_secret properties.
When Terraform evaluate the execution plan, it identifies the dependencies and provisions in the proper order. First it
creates the service and after resolving the api key and secret, it creates the OAuth client on the service just created.
terraform.workspace in the service_name and description of the service and
redirect_uris and client_name of the client. That will allow easy identification of the services in the console and
segregation of configuration by runtime.
Using workspace for managing environment
The workspace mechanism of Terraform fits the purpose of managing the different environments required for software development. In the section below, we declare a service that has the workspace name in its name and a client with that same info in the redirect uris. Let’s check how this mechanism can be used for managing a development, a test, and a production configuration. We start with creating a development env and creating the resources for development using the commands below:https://dev.mydomain.com/cb (probably resolving to 127.0.0.1).
When the development reaches a stage where the test env is available, the administrator can run the sequence of
command below:
