This Terraform configuration automates the provisioning of infrastructure resources on HUAWEI CLOUD. It creates a Virtual Private Cloud (VPC), subnet, Elastic IP (EIP), Elastic Cloud Server (ECS) instance, and associates the EIP with the ECS instance. Additionally, it sets up an organization in Huawei's SWR (Software Image Repository), pushes a Docker image to the SWR repository, installs Docker on the ECS instance, and runs the image on it.
Before running this Terraform configuration, ensure the following:
-
HUAWEI CLOUD Account: You must have a HUAWEI CLOUD account with appropriate permissions to create and manage resources.
-
Access Key and Secret Key: Obtain the Access Key and Secret Key of your HUAWEI CLOUD account.
-
Terraform Installation: Install Terraform on your local machine. You can download it from here and follow the installation instructions.
-
Docker Installation: Ensure Docker is installed and running on your local computer. You can download Docker Desktop from here.
-
Variables: Update the
variables.tf
file with your HUAWEI CLOUD access key, secret key, region, availability zone, passwords, and Docker-related configurations. -
Security Group: Ensure that port
5000
is open on the security group associated with your ECS instance on HUAWEI CLOUD. This is necessary for accessing the Docker image running on the ECS instance.
-
Initialize Terraform: Run
terraform init
in the directory containing the Terraform configuration files to initialize the working directory. -
Plan: Run
terraform plan
to see the execution plan. It will show you what actions Terraform will take when you apply the configuration. -
Apply: Run
terraform apply
to apply the Terraform configuration and provision the infrastructure resources on HUAWEI CLOUD.
- Ensure that Docker is up and running before executing the Terraform configuration.
-
Terraform Documentation: Refer to the official Terraform documentation for more information on Terraform usage and features.
-
HUAWEI CLOUD Documentation: Explore the HUAWEI CLOUD documentation for specific details on using HUAWEI CLOUD services.
-
HUAWEI CLOUD Terraform Documentation: HUAWEI CLOUD documentation specific for it's use with terraform.
-
For any issues or questions related to this Terraform configuration, please open an issue in this repository.