- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
ID: terraform-aws/ami-missing-owners
Language: Terraform
Severity: Error
Category: Security
This error is caused when most_recent
is set to true
and there is no owner attribute set or no owner or image filters. With this configuration, a third party may introduce a new image which will be returned by this data source, leading to unexpected changes.
Consider adding a owner
attribute, or filtering by owner-alias
, owner-id
, or image-id
to avoid this possibility.
# non-compliant
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
}
# compliant
data "aws_ami" "ubuntu" {
most_recent = true
owners = ["099720109477"] // Canonical
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
}
# compliant
data "aws_ami" "ubuntu" {
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-1234"]
}
}
# compliant
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "image-id"
values = ["ami-12345"]
}
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
filter {
name = "owner-id"
values = ["099720109477"]
}
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
filter {
name = "owner-alias"
values = ["amazon"]
}
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
owners = ["099720109477"] // Canonical
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "image-id"
values = ["ami-12345"]
}
}
data "aws_ami" "ubuntu" {
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-1234"]
}
}
data "aws_ami" "ubuntu" {
most_recent = true
owners = ["099720109477"] // Canonical
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
}