Step 1 - Creating AWS organization under Blotout SSO¶
The first step is to create the organization under Blotout SSO in Terraform Cloud. For this, a pipeline is already created and we just need to trigger it with right variables.
- A terraform organization with name
blotout-admin
is already created. This organiztaion is responsible for all the admin task which fall under theBlotout Infrastructure
strategy. - We need to set up terraform workspace in
blotout-admin
organization. Let's assume the name of the organization as example for the entire deployment- Create a workspace with name of the client's organization. The workspace should be named as the organization name with the environment-type as the prefix, for e.g. if name of organization is
example
and env type isprod
then name of the workspace will beprod-example
. To know more about this, check how to create a workspace. - Choose
/admin
in theterraform
github repository for version control with default branch pointing tomaster
. - Configure the following variables for the workspace. To know more, check how to create variables in a workspace
organization_name
- preferred name of the clientorganization_mail
- mail ID of the clientorganization_region
- chosen region of the clientenvironment
- env type chosen by the clientiam_user
- name of the user through which we will create the resource in the client account. (default:blotout-k8s
)role_name
- name of the role with restrictive permission that will get created in the client account and will be attached toiam_user
user (default:self-serve-role
)
- Create a workspace with name of the client's organization. The workspace should be named as the organization name with the environment-type as the prefix, for e.g. if name of organization is
-
A variable set is already created in the
blotout-admin
terraform organization with name ofadmin-varset
. We need to attach the client organizationexample
ifApply to specific workspaces
option is selected in theWorkspaces
section of the variable set. This variable set consists of 4 variables. To know more, check how to attach a variable setaws_access_key
- (secret) Access key of our blotout parent account.aws_secret_key
- (secret) Secret key of our blotout parent account.aws_region
- AWS region (default:us-east-1
)public_key
- public key to encrypt theiam_user
credentials.
Note: - These variables are set with their static values. Changing this is not recommended.
-
Run the pipeline. If needed, check how to run a pipeline
- Once the pipeline successfully finishes we will get the following variables as output
account_arn
- arn of the new client's accountaccount_id
- account IDiam_user_details
- (sensitive) credentials of theiam_user
encrypted bypublic_key
- Once the pipeline successfully finishes we will get the following variables as output
- If we go to Blotout SSO we will be able to see the organization now.
- To obtain the credentials for the AWS organization we need to first obtain the token and the workspace ID.
- Token is used to authenticate to the terraform cloud. To obtain Token
- click on your profile in terraform cloud
- click on User settings
- click on
Tokens
- click on
Create an API token
.
- Workspace ID is the unique ID of the workspace.
- go inside
blotout-admin
terraform organization. - Enter your workspace (here:
example
) - Just below the name of the workspace you will find your workspace ID starting with
ws
.
- go inside
- Token is used to authenticate to the terraform cloud. To obtain Token
-
To obtain the access key and secret key, you must have the private key corresponding to the public key used in the
public_key
variable (above) with its password to decrypt the output. -
You have your keys in the environment variable
ACCESS_KEY
andSECRET_KEY
.
Next step¶
Creating the terraform organization