Troubleshooting
Use this page when terraform plan or terraform apply reports an error, or when the plan wants to change more than you expect. Each section describes the symptom, the cause, and the fix.
Connection and authentication errors
| Message or symptom | Cause | Fix |
|---|---|---|
| Error when reading the tenant or VPC | The token has expired, tenant_name is wrong, or the account has no permission on the VPC. | Check FPTCLOUD_TOKEN and FPTCLOUD_TENANT_NAME. Create a new token if needed. |
please enter vpc name | The fptcloud_vpc data source is missing the name argument. | Look up the VPC by name. |
UnknownError: System error, please try again ! | FPT Cloud rejected the request, and the provider does not show the error details. | See Fix the "System error" message below. |
timeout while waiting for state | The operation took longer than the provider timeout, which defaults to 15 minutes. | Check the resource on Portal. If the operation is still running, increase timeout in the provider block and run the command again. |
Fix the "System error" message
When you get UnknownError: System error, please try again !, check the following in order:
- The token has not expired.
- Your Role allows that operation on the VPC. Ask the tenant administrator to check if needed.
- The related resources still exist on Portal.
- Each ID you pass belongs to the correct resource type, for example
subnet_idis the ID of a Subnet, not its name. - Perform the same operation on Portal to see the full error message.
Configuration errors
| Message | Cause | Fix |
|---|---|---|
Invalid index at images[0], flavors[0], or storage_policies[0] | The data source filter matches no result. | List the full list as shown in Look up information with data sources, then fix the filter values. |
name cannot contain whitespace | The resource name contains spaces. | Use a hyphen - instead of spaces. |
Missing required argument | A required argument is missing. | Add the argument named in the message. |
The root storage size of an instance can only be increased | storage_size_gb is smaller than the current root disk size. | Set a value equal to or larger than the current size. |
Storage name ... already exists | Another disk with the same name already exists in the VPC. | Give the disk a different name. |
Storage type can not be changed | You changed the type of an existing disk. | Keep the type unchanged. To change the disk type, create a new disk. |
For a Subnet, also check that the CIDR range does not overlap with other Subnets in the VPC, and that gateway_ip is inside the CIDR range.
Cannot delete a Security Group
Symptom: terraform destroy waits for a long time, then reports an error when deleting a Security Group.
Cause: FPT Cloud can delete a Security Group only when it is no longer attached to any resource.
Fix:
- Set
apply_to = []for the Security Group. - Run
terraform apply. - Run
terraform destroyagain.
See how to use a variable to do this more easily in Build a complete web application infrastructure.
The plan always reports changes
Symptom: after a successful apply, every terraform plan reports the same change.
| Cause | Fix |
|---|---|
| The resource was changed on Portal. | Update the configuration to match the current state, or change the resource only with Terraform. |
The Instance declares security_group_ids while the Security Group is attached through apply_to. | Remove security_group_ids from the Instance and use only apply_to. |
apply_to is empty, but the Security Group was also attached on Portal. | Add the IP to apply_to, or add lifecycle { ignore_changes = [apply_to] } to the Security Group. |
The private_ip or public_ip of the Instance was changed after creation. | These two arguments are used only at creation. Restore the old value, and use fptcloud_floating_ip_association to change the public IP. |
The plan wants to recreate a resource
Symptom: the plan shows must be replaced and # forces replacement.
Cause: you changed an argument that cannot be updated in place. For an Instance, these are vpc_id, subnet_id, image_name, ssh_key, and password. For a Subnet, these are all arguments except DNS and tags.
Fix: if you did not intend to recreate the resource, restore the argument to its old value. If image_name comes from an image filter, the filter may have returned a newer image. Pin the image name for that Instance.
Recreating an Instance deletes the root disk and all data on it. Do not apply a plan that contains forces replacement until you fully understand the cause.
A resource was deleted outside Terraform
Symptom: terraform plan reports that a resource cannot be found, for example Storage not found or Failed to retrieve instance.
Cause: the resource was deleted on Portal, but it is still in the Terraform state.
Fix: after you confirm on Portal that the resource no longer exists, remove the resource from the state:
terraform state rm fptcloud_storage.app_data
This command only removes the resource from the state and does not call FPT Cloud. The next terraform apply creates the resource again if it is still in the configuration.
The private IP of an Instance is empty
Symptom: an output or apply_to contains an empty string right after the Instance is created.
Cause: a newly created Instance may not report its private IP for a short time.
Fix: run terraform apply again. Read the IP through the fptcloud_instance data source as shown in Instance examples, because the data source is read again on every plan.
Collect information before contacting support
Turn on detailed logging, then run the failing command again:
export TF_LOG=DEBUG
export TF_LOG_PATH=terraform-debug.log
terraform apply
When you contact FPT Cloud, include:
- The time you ran the command.
- The address of the failing resource, for example
fptcloud_instance.web[0]. - The full error message.
- The provider version, taken from
terraform version.
The log file can contain sensitive information. Remove tokens and passwords from the log before you send it.