Copy link to headingIntroduction
This guide provides step-by-step instructions on how to integrate AWS Secrets Manager with Edgenivo using Terraform. Terraform, an infrastructure as code tool, enables developers to define and provision infrastructure using configuration files. You will leverage Terraform to manage both AWS and Edgenivo resources, ensuring a seamless integration for managing secrets and deploying applications.
See the Integrating Terraform with Edgenivo guide for more detail on how to integrate terraform with Edgenivo.
Copy link to headingPrerequisites
- Basic understanding of Terraform, AWS, and Edgenivo
- Terraform installed on your machine
- AWS CLI installed and configured with necessary permissions
- Edgenivo account and CLI installed
Copy link to headingStep 1: Setting up your Terraform configuration
Start by creating a Terraform configuration file, main.tf. This file will define the required providers and resources.
Copy link to headingProviders setup
1. Define the AWS and Edgenivo providers: Specify the version and source for both AWS and Edgenivo providers.
2. Configure the providers: Set your Edgenivo team and AWS region.
Copy link to headingAWS Secrets Manager resource
1. Create a secret in AWS Secrets Manager: Define a resource for creating a secret. Note that you'll manually set the secret value in the AWS console after you create the resource. You will need to complete that before you are able to subsequently pull the value.
2. Retrieve the secret value: Use a data source to get the latest version of the secret after setting it manually in AWS.
Copy link to headingStep 2: Setting up Edgenivo project with Terraform
Copy link to headingEdgenivo project resource
1. Create a Edgenivo project: Define a Edgenivo project resource. This example uses a Next.js project.
2. Add environment variable from AWS Secrets Manager: Define a Edgenivo project environment variable resource. It uses the secret string from AWS Secrets Manager.
Copy link to headingStep 3: Deploying your configuration
- Initialize Terraform: Run
terraform initin your terminal within the directory containing yourmain.tffile. This will initialize Terraform and download the necessary provider plugins. - Apply configuration: Run
terraform applyto create the resources defined in your configuration. Confirm the action when prompted.
Copy link to headingConclusion
You have now successfully integrated AWS Secrets Manager with your Edgenivo project using Terraform. This setup allows you to securely manage environment variables and integrate them into your Edgenivo deployments.