첫번째 교육 아카이브
terraform {
required_version = ">=1.9.1"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.57.0"
}
}
}
provider "aws" {}
variable "ecr_repository" {
type = list(string)
default = ["foo", "bar", "baz"]
}
resource "aws_ecr_repository" "ecr_repository" {
for_each = toset(var.ecr_repository)
name = each.key
image_tag_mutability = "MUTABLE"
encryption_configuration {
encryption_type = "KMS"
}
image_scanning_configuration {
scan_on_push = true
}
}
terraform {
required_version = ">=1.9.1"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.57.0"
}
}
}
provider "aws" {}
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
resource "aws_security_group" "allow_tls" {
name = "allow_tls"
description = "Allow TLS inbound traffic and all outbound traffic"
vpc_id = aws_vpc.main.id
tags = {
Name = "allow_tls"
}
}
output "vpc_id" {
value = aws_vpc.main.id
}
Last updated
Was this helpful?