znyang/ambig-iac huggingface dataset:
Task: sets up a dedicated-tenancy AWS VPC with DNS support and hostnames enabled, an internet gateway, and a route table for outbound internet access, all tagged with a variable name.

Specification:
Has one "aws_vpc" resource
with a specified "cidr_block"
with "enable_dns_support" and "enable_dns_hostnames" set to true
with "instance_tenancy" set to "dedicated"
with a "tags" map including a "Name" key referencing a variable

Has one "aws_internet_gateway" resource
with "vpc_id" referencing the "aws_vpc" resource
with a "tags" map including a "Name" key referencing a variable

Has one "aws_route_table" resource
with "vpc_id" referencing the "aws_vpc" resource


Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}

resource "aws_vpc" "dgraph" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_support   = true
  instance_tenancy     = "dedicated"

  # For enabling assignment of private dns addresses within AWS.
  enable_dns_hostnames = true

  tags = {
    Name = "var.name"
  }
}

resource "aws_internet_gateway" "dgraph_gw" {
  vpc_id = aws_vpc.dgraph.id

  tags = {
    Name = "var.name"
  }
}

resource "aws_route_table" "dgraph_igw" {
  vpc_id = aws_vpc.dgraph.id

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.dgraph_gw.id
  }

  tags = {
    Name = "var.name"
  }
}

Validation policy (checks.rego):
package terraform.validation

default is_valid_vpc = false
default is_valid_internet_gateway = false
default is_valid_route_table = false

# Validate aws_vpc resource
is_valid_vpc {
    some i
    resource := input.configuration.root_module.resources[i]
    resource.type == "aws_vpc"
    resource.expressions.cidr_block != null
    resource.expressions.enable_dns_support.constant_value == true
    resource.expressions.enable_dns_hostnames.constant_value == true
    resource.expressions.instance_tenancy.constant_value == "dedicated"
    resource.expressions.tags.constant_value["Name"] != null
}

# Validate aws_internet_gateway resource
is_valid_internet_gateway {
    some i
    resource := input.configuration.root_module.resources[i]
    resource.type == "aws_internet_gateway"
    resource.expressions.vpc_id.references[0] == "aws_vpc.dgraph.id"
    resource.expressions.tags.constant_value["Name"] != null
}

# Validate aws_route_table resource
is_valid_route_table {
    some i
    resource := input.configuration.root_module.resources[i]
    resource.type == "aws_route_table"
    resource.expressions.vpc_id.references[0] == "aws_vpc.dgraph.id"
}
Task: creates a VPC with a CIDR block of 10.0.0.0/16 and an internet gateway in the AWS us-east-2 region, both tagged with names "vpc" and "ig" respectively.

Specification:
Has one "aws_vpc" resource:
with a specified "cidr_block" of "10.0.0.0/16"
with "enable_dns_hostnames" set to true
with a "tags" map that is not null, including at least a "Name" key with a value

Has one "aws_internet_gateway" resource:
with "vpc_id" referencing the "aws_vpc" resource by its ID
with a "tags" map that is not null, including at least a "Name" key with a value

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}

resource "aws_vpc" "_" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  tags = merge({
    "Name" = "vpc"
  })
}

resource "aws_internet_gateway" "_" {
  vpc_id = aws_vpc._.id
  tags = merge({
    "Name" = "ig"
  })
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_vpc = false

default is_valid_internet_gateway = false

# Validate aws_vpc resource
is_valid_vpc {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc"
        resource.expressions.cidr_block.constant_value == "10.0.0.0/16"
        resource.expressions.enable_dns_hostnames.constant_value == true
        resource.expressions.tags != null
}

# Validate aws_internet_gateway resource
is_valid_internet_gateway {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_internet_gateway"
        resource.expressions.vpc_id.references[0] == "aws_vpc._.id"
        resource.expressions.tags != null
}
Task: creates a VPC with a CIDR block, and an internet gateway in the AWS us-east-2 region, both tagged with names "vpc" and "ig" respectively.

Specification:
Has one "aws_vpc" resource:
with a specified "cidr_block"
with "enable_dns_hostnames" set to true

Has one "aws_internet_gateway" resource:
with "vpc_id" referencing the "aws_vpc" resource by its ID
with a "tags" map that is not null, including at least a "Name" key with a value

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}

resource "aws_vpc" "_" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  tags = merge({
    "Name" = "vpc"
  })
}

resource "aws_internet_gateway" "_" {
  vpc_id = aws_vpc._.id
  tags = merge({
    "Name" = "ig"
  })
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_vpc = false

default is_valid_internet_gateway = false

# Validate aws_vpc resource
is_valid_vpc {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc"
        resource.expressions.cidr_block.constant_value != null
        resource.expressions.enable_dns_hostnames.constant_value == true
        resource.expressions.tags != null
}

# Validate aws_internet_gateway resource
is_valid_internet_gateway {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_internet_gateway"
        resource.expressions.vpc_id.references[0] == "aws_vpc._.id"
        resource.expressions.tags != null
}
Task: creates a VPC with a CIDR block of 10.0.0.0/16 and an internet gateway in the AWS us-east-2 region

Specification:
Has one "aws_vpc" resource:
with a specified "cidr_block" of "10.0.0.0/16"
with "enable_dns_hostnames" set to true


Has one "aws_internet_gateway" resource:
with "vpc_id" referencing the "aws_vpc" resource by its ID

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}

resource "aws_vpc" "_" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  tags = merge({
    "Name" = "vpc"
  })
}

resource "aws_internet_gateway" "_" {
  vpc_id = aws_vpc._.id
  tags = merge({
    "Name" = "ig"
  })
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_vpc = false

default is_valid_internet_gateway = false

# Validate aws_vpc resource
is_valid_vpc {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc"
        resource.expressions.cidr_block.constant_value == "10.0.0.0/16"
        resource.expressions.enable_dns_hostnames.constant_value == true
}

# Validate aws_internet_gateway resource
is_valid_internet_gateway {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_internet_gateway"
        resource.expressions.vpc_id.references[0] == "aws_vpc._.id"
}
Task: creates a VPC with a CIDR block and an internet gateway in the AWS us-east-2 region, both tagged with names "vpc" and "ig" respectively.

Specification:
Has one "aws_vpc" resource:
with a specified "cidr_block"
with "enable_dns_hostnames" set to true
with a "tags" map that is not null, including at least a "Name" key with a value

Has one "aws_internet_gateway" resource:
with "vpc_id" referencing the "aws_vpc" resource by its ID
with a "tags" map that is not null, including at least a "Name" key with a value

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}

resource "aws_vpc" "_" {
  cidr_block           = "10.0.0.0/16"
  enable_dns_hostnames = true
  tags = merge({
    "Name" = "vpc"
  })
}

resource "aws_internet_gateway" "_" {
  vpc_id = aws_vpc._.id
  tags = merge({
    "Name" = "ig"
  })
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_vpc = false

default is_valid_internet_gateway = false

# Validate aws_vpc resource
is_valid_vpc {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc"
        resource.expressions.cidr_block.constant_value != null
        resource.expressions.enable_dns_hostnames.constant_value == true
        resource.expressions.tags != null
}

# Validate aws_internet_gateway resource
is_valid_internet_gateway {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_internet_gateway"
        resource.expressions.vpc_id.references[0] == "aws_vpc._.id"
        resource.expressions.tags != null
}
Task: creates an egress-only internet gateway named "pike" associated with a specified VPC, allowing IPv6-enabled instances to connect to the internet without allowing inbound internet traffic, and tags it with "permissions".

Specification:
Has one "aws_egress_only_internet_gateway" resource:
Associated with a specified "aws_vpc" resource
Designed to allow IPv6-enabled instances within the VPC to connect to the internet while preventing inbound internet traffic
Tagged with "permissions" to categorize or specify its role or access levels within the infrastructure

Terraform configuration (main.tf):
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}

resource "aws_egress_only_internet_gateway" "pike" {
  vpc_id = "vpc-0c33dc8cd64f408c4"
  tags = {
    pike = "permissions"
  }
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation state for aws_egress_only_internet_gateway
default is_valid_egress_only_internet_gateway = false

# Validate aws_egress_only_internet_gateway resource
is_valid_egress_only_internet_gateway {
	some i
	resource := input.configuration.root_module.resources[i]
	resource.type == "aws_egress_only_internet_gateway"
	resource.expressions.vpc_id.constant_value != null
	resource.expressions.tags.constant_value != null # Verifies it is tagged with "permissions"
}
Task: creates an egress-only internet gateway associated with a specified VPC, allowing IPv6-enabled instances to connect to the internet without allowing inbound internet traffic

Specification:
Has one "aws_egress_only_internet_gateway" resource:
Associated with a specified "aws_vpc" resource
Designed to allow IPv6-enabled instances within the VPC to connect to the internet while preventing inbound internet traffic


Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

resource "aws_egress_only_internet_gateway" "pike" {
  vpc_id = "vpc-0c33dc8cd64f408c4"
  tags = {
    pike = "permissions"
  }
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation state for aws_egress_only_internet_gateway
default is_valid_egress_only_internet_gateway = false

# Validate aws_egress_only_internet_gateway resource
is_valid_egress_only_internet_gateway {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_egress_only_internet_gateway"
        resource.expressions.vpc_id.constant_value != null
        
}
Task: creates DHCP options named "pike" for an AWS VPC, specifying Google's DNS servers (8.8.8.8 and 8.8.4.4), and then associates these DHCP options with a specified VPC, tagging both the DHCP options and their association with "permissions".

Specification:
Has one "aws_vpc_dhcp_options" resource:
Specifies Google's DNS servers (8.8.8.8 and 8.8.4.4) as the DNS servers for the DHCP options
Tagged with "permissions" to categorize or specify its role or access levels within the infrastructure

Has one 
"aws_vpc_dhcp_options_association" resource:
Associates the "aws_vpc_dhcp_options" with a specified "aws_vpc" resource
Tagged with "permissions" to ensure consistent labeling and access management across related resources

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}


resource "aws_vpc_dhcp_options_association" "pike" {
  dhcp_options_id = aws_vpc_dhcp_options.pike.id
  vpc_id          = "vpc-0c33dc8cd64f408c4"
}

resource "aws_vpc_dhcp_options" "pike" {
  domain_name_servers = ["8.8.8.8", "8.8.4.4"]
  tags = {
    pike = "permissions"
  }
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_dhcp_options = false

default is_valid_dhcp_options_association = false

# Validate aws_vpc_dhcp_options resource
is_valid_dhcp_options {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options"

        # Check for the specified DNS servers
        dns_servers := ["8.8.8.8", "8.8.4.4"]
        resource.expressions.domain_name_servers.constant_value == dns_servers
        resource.expressions.tags.constant_value != null
}

# Validate aws_vpc_dhcp_options_association resource
is_valid_dhcp_options_association {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options_association"
        resource.expressions.dhcp_options_id.references[0] == "aws_vpc_dhcp_options.pike.id"
        resource.expressions.vpc_id != null
}
Task: creates DHCP options named "pike" for an AWS VPC, specifying Google's DNS servers, and then associates these DHCP options with a specified VPC, tagging both the DHCP options and their association with "permissions".

Specification:
Has one "aws_vpc_dhcp_options" resource:
Specifies Google's DNS servers
Tagged with "permissions" to categorize or specify its role or access levels within the infrastructure

Has one 
"aws_vpc_dhcp_options_association" resource:
Associates the "aws_vpc_dhcp_options" with a specified "aws_vpc" resource
Tagged with "permissions" to ensure consistent labeling and access management across related resources

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}


resource "aws_vpc_dhcp_options_association" "pike" {
  dhcp_options_id = aws_vpc_dhcp_options.pike.id
  vpc_id          = "vpc-0c33dc8cd64f408c4"
}

resource "aws_vpc_dhcp_options" "pike" {
  domain_name_servers = ["8.8.8.8", "8.8.4.4"]
  tags = {
    pike = "permissions"
  }
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_dhcp_options = false

default is_valid_dhcp_options_association = false

# Validate aws_vpc_dhcp_options resource
is_valid_dhcp_options {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options"
        resource.expressions.tags.constant_value != null
}

# Validate aws_vpc_dhcp_options_association resource
is_valid_dhcp_options_association {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options_association"
        resource.expressions.dhcp_options_id.references[0] == "aws_vpc_dhcp_options.pike.id"
        resource.expressions.vpc_id != null
}
Task: creates DHCP options named "pike" for an AWS VPC, specifying Google's DNS servers (8.8.8.8 and 8.8.4.4), and then associates these DHCP options with a specified VPC

Specification:
Has one "aws_vpc_dhcp_options" resource:
Specifies Google's DNS servers (8.8.8.8 and 8.8.4.4) as the DNS servers for the DHCP options
Tagged with "permissions" to categorize or specify its role or access levels within the infrastructure

Has one 
"aws_vpc_dhcp_options_association" resource:
Associates the "aws_vpc_dhcp_options" with a specified "aws_vpc" resource

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}


resource "aws_vpc_dhcp_options_association" "pike" {
  dhcp_options_id = aws_vpc_dhcp_options.pike.id
  vpc_id          = "vpc-0c33dc8cd64f408c4"
}

resource "aws_vpc_dhcp_options" "pike" {
  domain_name_servers = ["8.8.8.8", "8.8.4.4"]
  tags = {
    pike = "permissions"
  }
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_dhcp_options = false

default is_valid_dhcp_options_association = false

# Validate aws_vpc_dhcp_options resource
is_valid_dhcp_options {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options"

        # Check for the specified DNS servers
        dns_servers := ["8.8.8.8", "8.8.4.4"]
        resource.expressions.domain_name_servers.constant_value == dns_servers
        resource.expressions.tags.constant_value != null
}

# Validate aws_vpc_dhcp_options_association resource
is_valid_dhcp_options_association {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options_association"
        resource.expressions.dhcp_options_id.references[0] == "aws_vpc_dhcp_options.pike.id"
        resource.expressions.vpc_id != null
}
Task: sets up a basic AWS network infrastructure consisting of a Virtual Private Cloud (VPC) with a custom DHCP options set. The VPC is configured with a CIDR block of 192.168.0.0/16. The DHCP options include a domain name (windomain.local), a combination of custom and Google's DNS servers (192.168.56.102 and 8.8.8.8), and a NetBIOS name server (192.168.56.102). These DHCP options are then associated with the created VPC, customizing its DHCP settings.

Specification:
Has one "aws_vpc" resource:
Configured with a "cidr_block" of "192.168.0.0/16"
Includes associated custom DHCP options

Has one "aws_vpc_dhcp_options" resource:
Specifies a "domain_name" of "windomain.local"
Includes DNS servers with a combination of a custom DNS server ("192.168.56.102") and Google's DNS server ("8.8.8.8")
Configures a "NetBIOS" name server at "192.168.56.102"

Has one "aws_vpc_dhcp_options_association" resource:
Associates the "aws_vpc_dhcp_options" with the created "aws_vpc"
Customizes DHCP settings specifically for the created VPC environment

Terraform configuration (main.tf):
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.16"
    }
  }

  required_version = ">= 1.2.0"
}
# Define the provider block for AWS
provider "aws" {
  region = "us-east-2" # Set your desired AWS region
}

resource "aws_vpc" "default" {
  cidr_block = "192.168.0.0/16"
}

resource "aws_vpc_dhcp_options" "default" {
  domain_name          = "windomain.local"
  domain_name_servers  = concat(["192.168.56.102"], ["8.8.8.8"])
  netbios_name_servers = ["192.168.56.102"]
}

resource "aws_vpc_dhcp_options_association" "default" {
  vpc_id          = aws_vpc.default.id
  dhcp_options_id = aws_vpc_dhcp_options.default.id
}

Validation policy (checks.rego):
package terraform.validation

# Set default validation states
default is_valid_vpc = false

default is_valid_dhcp_options = false

default is_valid_dhcp_options_association = false

# Validate aws_vpc resource
is_valid_vpc {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc"
        resource.expressions.cidr_block.constant_value == "192.168.0.0/16"
}

# Validate aws_vpc_dhcp_options resource
is_valid_dhcp_options {
        some i
        resource := input.planned_values.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options"
        resource.values.domain_name == "windomain.local"
    resource.values.domain_name_servers == ["192.168.56.102", "8.8.8.8"]
        resource.values.netbios_name_servers == ["192.168.56.102"]
}

# Validate aws_vpc_dhcp_options_association resource
is_valid_dhcp_options_association {
        some i
        resource := input.configuration.root_module.resources[i]
        resource.type == "aws_vpc_dhcp_options_association"
        resource.expressions.dhcp_options_id.references[0] == "aws_vpc_dhcp_options.default.id"
        resource.expressions.vpc_id.references[0] == "aws_vpc.default.id"
}