Provision VPC
Journey Map
Overview
Provisioning of a VPC can be accomplished via the IBM Cloud Portal User Interface, IBM Cloud CLI, or via Terraform. In this deployment guide, automation via Terraform will be leveraged.
If you are brand new to IBM Cloud, a video showing how to use Portal UI to create a VPC may be a good first step to orient yourself around some of the concepts. However, as you start to create multiple VPCs and want to leverage consistent repeatable patterns, you'll find Terrform automation to be more efficient.
To get started, the following Multi-zone VPC architecture will be used.
Getting Started
IBM Cloud Schematics allows you to "run terraform in the cloud" and provides a centralized location to manage the terraform state files and logs.
Import VPC Terraform Code to Schematics
-
Login to IBM Cloud and navigate to the IBM Schematics service as shown in the figure below:
-
From the Schematics Workspace tab, choose to create a new project workspace.
-
Schematics can automatically pull terraform code from a GitHub repo. Enter
https://github.com/IBM-Cloud/cloud-journey/tree/main/VPC
as the repository URL (which represents the VPC architecture depicted above) and select terraform_v1.0. -
Specify the workspace details values based on your preferences.
As a best practice, do NOT use the "default" resource group. Create a resource group for this network or project provides more flexibility. For additional details see the Preparing Your IBM Cloud Account page of this deployment journey guide.
-
Validate the information entered and click Create to retrieve the Terraform code and create the Schematics workspace.
Configure Terraform Variables
-
If not already there, navigate to the Settings page of your new Schematics workspace where you will see a list of variables (and their default values) which were found in the Terraform code.
-
Enter a value for the IBM Cloud API Key variable (if it exists) by clicking on the action menu.
The API key is the credential the terraform code will run under and may we associated with a userid or a serviceid. To generate an API Key, click on Manage (located in top menu bar), select IAM, and then API keys. When entering the value in Schematics, be sure to select the "Sensitive" checkbox.
-
Inspect the remaining variables and update the values as needed. For example, you will most likely need to update the resource group name.
Refer to the readme which accompanies the Terraform code for descriptions on variable names and their usage. In this example, you will see variables for configuring the subnet tiers, whether or not public gateways for a zone are enabled, subnet acl rules, etc.
Apply VPC Terraform Code
-
Click the Generate plan to validate the configuration. This is similar to running
terraform plan
when using the CLI. No changes will be made nor any resources deployed. This will only perform a test run. -
If the generate action completes successfully, click on the Apply plan button to provision this cloud native configuration on VPC.
-
Once the apply plan completes successfully, click on the menu icon (located in the top left corner) and navigate to the VPC Infrastructure page to browse your newly created VPC instance!
-
(Optional) If you would like to delete/destroy the VPC resources which was created, go back to the Schematics Workspace and select Actions > Destroy resources.
Additional VPC Deployment Patterns and Resources
Now that you understand how to deploy a VPC, explore some additional deployment patterns using the resources below:
Next Steps
The next step on the deployment journey is: