This section explains how to install CSC AWS PriCPA using Terraform.
Before installation, please:
- Download and extract the folder containing the Terraform template (file attached at the bottom of this document: terraform-csc-pricpa-aws-v-1-1.zip).
- Ensure Terraform is installed on the system; if not installed, please download from the official documents. (Reference URL – https://www.terraform.io/downloads).
- (Advanced) If you are using Terraform through command line with path, consider installing AWS CLI for secret access key reasons. (See https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html and https://registry.terraform.io/providers/hashicorp/aws/latest/docs)
Installation Steps:
Inside the Terraform template folder, open and update the three following files: configUserData.json provider.tf terraform.auto.tfvars
1 - Update file "provider.tf" file with your AWS access and secret keys. (Generate these keys for the IAM user from AWS console and ensure required permissions are granted to the keys).
Note: If you already have the keys provisioned via "aws configure" command or via environment variables, modify these keys' lines in the file so Terraform ignores them:
2 - Update the file "terraform.auto.tfvars" with the required network and instance values, including VPC ID, Subnet IDs, Stack name, region, instance name, instance type and keyname of SSH Key. (Please ensure the stack name is unique as it will be used for the creation of security groups and other components. We recommend using the same name on "stack name" and "instance name").
3 - (Optional) Update configUserData.json with the userdata in JSON format for the instance to be provisioned. Terraform will automatically read the JSON and convert it to base64.
4 - (Deployment) Once all required changes are made, trigger the following commands to provision the Terraform template’s Virtual machine. Please ensure all the below-mentioned commands are triggered from the base module directory (the same directory as “configUserData.json” and “terraform.auto.tfvars”):
4.1 - Trigger "terraform init" command to initialize the AWS provider. Each time a new module is added, it’s necessary to rerun this command.
4.2 - Trigger "terraform plan" command to check what will get provisioned. This command will not provision the resources but will just show what will get provisioned.
4.3 - Trigger "terraform apply" command to create the resources. This will prompt you for approval, type "yes" once prompted.
Use the following reference link to know more about terraform commands – https://www.terraform.io/cli/commands