Renaming (tagging) an existing resource


I literally started working with terraform two days ago, so please excuse any silly questions. So far, I’ve set up visual studio code to work with terraform and I created a new VPC on AWS.

Creating a new VPC though, also creates a route table, network acls, a security group and many other resources. I want to tag them with a name.

This is what I have so far

provider "aws" {
    access_key = ""
    secret_key = ""
    region = "eu-central-1"

resource "aws_vpc" "main" {
  cidr_block = ""
  instance_tenancy = "default"
  enable_dns_hostnames = "true"

    tags = {
    Name = "MyVPC"

resource "aws_network_acl" "main" {
  vpc_id =

  tags = {
    Name = "MyNetworkAcls"

Instead of creating a name tag on the acls resource, it creates a new acls resource and gives it the name “MyNetworkAcls”. Whereas I want to tag the existing acls resource that the VPC created.

How can I do that?