Resource: aws_vpc_endpoint_policy

Provides a VPC Endpoint Policy resource.

Example Usage

data "aws_vpc_endpoint_service" "example" {
  service = "dynamodb"
}

resource "aws_vpc" "example" {
  cidr_block = "10.0.0.0/16"
}

resource "aws_vpc_endpoint" "example" {
  service_name = data.aws_vpc_endpoint_service.example.service_name
  vpc_id       = aws_vpc.example.id
}

resource "aws_vpc_endpoint_policy" "example" {
  vpc_endpoint_id = aws_vpc_endpoint.example.id
  policy = jsonencode({
    "Version" : "2012-10-17",
    "Statement" : [
      {
        "Sid" : "AllowAll",
        "Effect" : "Allow",
        "Principal" : {
          "AWS" : "*"
        },
        "Action" : [
          "dynamodb:*"
        ],
        "Resource" : "*"
      }
    ]
  })
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import VPC Endpoint Policies using the id. For example:

import {
  to = aws_vpc_endpoint_policy.example
  id = "vpce-3ecf2a57"
}

Using terraform import, import VPC Endpoint Policies using the id. For example:

% terraform import aws_vpc_endpoint_policy.example vpce-3ecf2a57