Terraform apply examples with errors

From wikieduonline
Jump to navigation Jump to search

Errors[edit]

Selected providers to generate the following execution plan[edit]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  + create

Terraform will perform the following actions:

  # module.ec2_cluster.aws_instance.this[0] will be created
  + resource "aws_instance" "this" {
      + ami                                  = "ami-ebd02392"
      + arn                                  = (known after apply)
      + associate_public_ip_address          = (known after apply)
      + availability_zone                    = (known after apply)
      + cpu_core_count                       = (known after apply)
      + cpu_threads_per_core                 = (known after apply)
      + disable_api_termination              = false
      + ebs_optimized                        = false
      + get_password_data                    = false
      + host_id                              = (known after apply)
      + id                                   = (known after apply)
      + instance_initiated_shutdown_behavior = (known after apply)
      + instance_state                       = (known after apply)
      + instance_type                        = "t2.micro"
      + ipv6_address_count                   = (known after apply)
      + ipv6_addresses                       = (known after apply)
      + key_name                             = "user1"
      + monitoring                           = false
      + outpost_arn                          = (known after apply)
      + password_data                        = (known after apply)
      + placement_group                      = (known after apply)
      + primary_network_interface_id         = (known after apply)
      + private_dns                          = (known after apply)
      + private_ip                           = (known after apply)
      + public_dns                           = (known after apply)
      + public_ip                            = (known after apply)
      + secondary_private_ips                = (known after apply)
      + security_groups                      = (known after apply)
      + source_dest_check                    = true
      + subnet_id                            = "subnet-eddcdzz4"
      + tags                                 = {
          + "Environment" = "dev"
          + "Name"        = "my-instance"
          + "Terraform"   = "true"
        }
      + tags_all                             = {
          + "Environment" = "dev"
          + "Name"        = "my-instance"
          + "Terraform"   = "true"
        }
      + tenancy                              = "default"
      + user_data                            = (known after apply)
      + user_data_base64                     = (known after apply)
      + volume_tags                          = {
          + "Name" = "my-instance"
        }
      + vpc_security_group_ids               = [
          + "sg-12345678",
        ]

      + capacity_reservation_specification {
          + capacity_reservation_preference = (known after apply)

          + capacity_reservation_target {
              + capacity_reservation_id = (known after apply)
            }
        }

      + credit_specification {
          + cpu_credits = "standard"
        }

      + ebs_block_device {
          + delete_on_termination = (known after apply)
          + device_name           = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + snapshot_id           = (known after apply)
          + tags                  = (known after apply)
          + throughput            = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = (known after apply)
          + volume_type           = (known after apply)
        }

      + enclave_options {
          + enabled = (known after apply)
        }

      + ephemeral_block_device {
          + device_name  = (known after apply)
          + no_device    = (known after apply)
          + virtual_name = (known after apply)
        }

      + metadata_options {
          + http_endpoint               = (known after apply)
          + http_put_response_hop_limit = (known after apply)
          + http_tokens                 = (known after apply)
        }

      + network_interface {
          + delete_on_termination = (known after apply)
          + device_index          = (known after apply)
          + network_interface_id  = (known after apply)
        }

      + root_block_device {
          + delete_on_termination = (known after apply)
          + device_name           = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + tags                  = (known after apply)
          + throughput            = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = (known after apply)
          + volume_type           = (known after apply)
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Error launching source instance[edit]

module.ec2_cluster.aws_instance.this[0]: Creating...
╷
│ Error: Error launching source instance: InvalidAMIID.NotFound: The image id '[ami-ebd02392]' does not exist
│       status code: 400, request id: 3875ad13-7a52-4026-8cca-6f6bbf1133d9
│
│   with module.ec2_cluster.aws_instance.this[0],
│   on .terraform/modules/ec2_cluster/main.tf line 5, in resource "aws_instance" "this":
│    5: resource "aws_instance" "this" {
│
╵

No configuration files[edit]

terraform apply
╷
│ Error: No configuration files
│
│ Apply requires configuration to be present. Applying without a configuration would mark
│ everything for destruction, which is normally not what is desired. If you would like to
│ destroy everything, run 'terraform destroy' instead.
╵

Missing required argument[edit]

terraform apply
╷
│ Error: Missing required argument
│
│ The argument "region" is required, but was not set.
╵

An execution plan has been generated and is shown below[edit]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:

Terraform will perform the following actions:

Plan: 0 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes


Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

text = hello world

RequestError: send request failed ... read: connection refused[edit]

╷
│ Error: error waiting for EKS Cluster (education-eks-MYOds9bJ) to create: RequestError: send request failed
│ caused by: Get "https://eks.us-east-2.amazonaws.com/clusters/education-eks-MYOds9bJ": dial tcp: lookup eks.us-east- 2.amazonaws.com on [::1]:53: read udp [::1]:56046->[::1]:53: read: connection refused
│
│   with module.eks.aws_eks_cluster.this[0],
│   on .terraform/modules/eks/main.tf line 11, in resource "aws_eks_cluster" "this":
│   11: resource "aws_eks_cluster" "this" {
│
╵


╷
│ Error: error waiting for Route in Route Table (rtb-04f3bf76b052eea13) with destination (0.0.0.0/0) to become available: RequestError: send request failed
│ caused by: Post "https://ec2.us-east-2.amazonaws.com/": dial tcp: lookup ec2.us-east-2.amazonaws.com on [::1]:53: read udp [::1]:59999->[::1]:53: read: connection refused
│
│   with module.vpc.aws_route.private_nat_gateway[0],
│   on .terraform/modules/vpc/main.tf line 1110, in resource "aws_route" "private_nat_gateway":
│ 1110: resource "aws_route" "private_nat_gateway" {
│
╵

ResourceInUseException: Cluster already exists with name:[edit]

╷
│ Error: error creating EKS Cluster (education-eks-MYOds9bJ): ResourceInUseException: Cluster already exists with name: education-eks-MYOds9bJ
│ {
│   RespMetadata: {
│     StatusCode: 409,
│     RequestID: "564d1b9e-098e-4d15-8a40-632fc256b14a"
│   },
│   ClusterName: "education-eks-MYOds9bJ",
│   Message_: "Cluster already exists with name: education-eks-MYOds9bJ"
│ }
│
│   with module.eks.aws_eks_cluster.this[0],
│   on .terraform/modules/eks/main.tf line 11, in resource "aws_eks_cluster" "this":
│   11: resource "aws_eks_cluster" "this" {
│
╵

RouteAlreadyExists[edit]

╷
│ Error: error creating Route in Route Table (rtb-04f3bf76b052eea13) with destination (0.0.0.0/0): RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.
│       status code: 400, request id: 9916c623-b992-460d-a87c-68a9b59db692
│
│   with module.vpc.aws_route.private_nat_gateway[0],
│   on .terraform/modules/vpc/main.tf line 1110, in resource "aws_route" "private_nat_gateway":
│ 1110: resource "aws_route" "private_nat_gateway" {
│
╵


GCP: Compute Engine API has not been used in project[edit]

google_compute_network.vpc: Creating...
╷
│ Error: Error creating Network: googleapi: Error 403: Compute Engine API has not been used in project 01234567899 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=666606097222 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

Error: Unable to continue with install:[edit]

Error: Unable to continue with install: ClusterRole "nginx-ingress-controller" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-namespace" must equal "nginx": current value is "nginx-ingress"

Errors[edit]

Related[edit]

See also[edit]

Advertising: