Apply cancelled during terraform apply

Hello Team,

I am new in the Terraform community & I am getting errors while spinup my 1st resources.

  + 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: y

Apply cancelled.
[root@ip-172-31-94-167 Terra]#

====================
[root@ip-172-31-94-167 Terra]# cat terraform.txt |tail -20
2021-10-06T09:30:33.182Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: writing state object for aws_instance.example
2021-10-06T09:30:33.182Z [TRACE] writeChange: recorded Create change for aws_instance.example
2021-10-06T09:30:33.182Z [TRACE] vertex “aws_instance.example”: visit complete
2021-10-06T09:30:33.182Z [TRACE] vertex “aws_instance.example”: dynamic subgraph completed successfully
2021-10-06T09:30:33.182Z [TRACE] vertex “aws_instance.example”: visit complete
2021-10-06T09:30:33.182Z [TRACE] vertex “aws_instance.example (expand)”: dynamic subgraph completed successfully
2021-10-06T09:30:33.182Z [TRACE] vertex “aws_instance.example (expand)”: visit complete
2021-10-06T09:30:33.182Z [TRACE] vertex “meta.count-boundary (EachMode fixup)”: starting visit (*terraform.NodeCountBoundary)
2021-10-06T09:30:33.182Z [TRACE] vertex “meta.count-boundary (EachMode fixup)”: visit complete
2021-10-06T09:30:33.182Z [TRACE] vertex “provider[“registry.terraform.io/hashicorp/aws”] (close)”: starting visit (*terraform.graphNodeCloseProvider)
2021-10-06T09:30:33.182Z [TRACE] GRPCProvider: Close
2021-10-06T09:30:33.183Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err=“rpc error: code = Unavailable desc = transport is closing”
2021-10-06T09:30:33.185Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.61.0/linux_amd64/terraform-provider-aws_v3.61.0_x5 pid=13694
2021-10-06T09:30:33.185Z [DEBUG] provider: plugin exited
2021-10-06T09:30:33.185Z [TRACE] vertex “provider[“registry.terraform.io/hashicorp/aws”] (close)”: visit complete
2021-10-06T09:30:33.185Z [TRACE] vertex “root”: starting visit (*terraform.nodeCloseModule)
2021-10-06T09:30:33.185Z [TRACE] vertex “root”: visit complete
2021-10-06T09:30:33.191Z [DEBUG] command: asking for input: “\nDo you want to perform these actions?”
2021-10-06T09:30:34.319Z [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2021-10-06T09:30:34.320Z [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
[root@ip-172-31-94-167 Terra]#

Hi @Himani19111,

The confirmation dialog states “Only ‘yes’ will be accepted to approve.”, but you entered only y. You need to type yes there.

Alternatively, you can save the plan output to a file which can be inspected and applied as needed

% terraform plan -out planfile
% terraform apply planfile

========
Hi jbardin,

Thanku so much for correcting me.
Now its spin-up.

Hi Jbardin,

i have created 4 instances & i wanna taint 2 or all 4 instances so i used the below ways but got an error.
Could you please assist me?

[root@ip-172-31-94-167 terraform-demo]# terraform state list
aws_instance.my-machine[0]
aws_instance.my-machine[1]
aws_instance.my-machine[2]
aws_instance.my-machine[3]
[root@ip-172-31-94-167 terraform-demo]# terraform taint -module=mymodule aws_instance.my-machine.*
Usage: terraform [global options] taint [options]

Terraform uses the term “tainted” to describe a resource instance
which may not be fully functional, either because its creation
partially failed or because you’ve manually marked it as such using
this command.

This will not modify your infrastructure directly, but subsequent
Terraform plans will include actions to destroy the remote object
and create a new object to replace it.

You can remove the “taint” state from a resource instance using
the “terraform untaint” command.

The address is in the usual resource address syntax, such as:
aws_instance.foo
aws_instance.bar[1]
module.foo.module.bar.aws_instance.baz

Use your shell’s quoting or escaping syntax to ensure that the
address will reach Terraform correctly, without any special
interpretation.

Options:

-allow-missing If specified, the command will succeed (exit code 0)
even if the resource is missing.

-lock=false Don’t hold a state lock during the operation. This is
dangerous if others might concurrently run commands
against the same workspace.

-lock-timeout=0s Duration to retry a state lock.

-ignore-remote-version A rare option used for the remote backend only. See
the remote backend documentation for more information.

-state, state-out, and -backup are legacy options supported for the local
backend only. For more information, see the local backend’s documentation.
Error parsing command-line flags: flag provided but not defined: -module

[root@ip-172-31-94-167 terraform-demo]#

The argument aws_instance.my-machine.* is a shell globbing pattern, and since you likely have no matching files in your working directory, there are no positional arguments passed to terraform, which is why you get the help text output.

There is also no longer a -module argument to the taint command, which you can see in the help text is replaced by the module.modulename... addressing format. Terraform splat (*) expressions however are not allowed for the taint command, so you would need to address each individual instance you want to taint:

% terraform taint 'module.mymodule.aws_instance.my-machine[0]'