1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Terraformエラー

Posted at

terraform init / terraform plan エラー対応

名前制限によるエラー

名前の先頭は文字かアンダースコアである必要がある。

% terraform init
╷
│ Error: Invalid resource name
│ 
│   on vpc.tf line 1, in resource "aws_vpc" "1234_my-vpc":
│    1: resource "aws_vpc" "1234_my-vpc" {
│ 
│ A name must start with a letter or underscore and may contain only letters,
│ digits, underscores, and dashes.
╵

変更前

名前の先頭が数字で始まっていた。

resource "aws_vpc" "1234_my-vpc" {
  cidr_block           = "10.0.0.0/16"
  instance_tenancy     = "default"
  enable_dns_support   = true
  enable_dns_hostnames = true

  tags = {
    Name = "1234_my-vpc"
  }
}

変更後

名前の先頭にアンダースコアを入れた。タグの文字列は数字のままで問題なし。

resource "aws_vpc" "_1234_my-vpc" {
  cidr_block           = "10.0.0.0/16"
  instance_tenancy     = "default"
  enable_dns_support   = true
  enable_dns_hostnames = true

  tags = {
    Name = "1234_my-vpc"
  }
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?