Skip to content

This Terraform provider allows users to fetch AWS AMI IDs from a DynamoDB table using a custom filter expression. It simplifies the process of retrieving AMI IDs based on specific conditions, making it easier to manage and provision AWS resources.

Notifications You must be signed in to change notification settings

dyudin0821/terraform-provider-amidynamodb

Repository files navigation

Terraform AWS AMI ID Provider

This Terraform provider retrieves the Amazon Machine Image (AMI) ID value from an AWS DynamoDB table using a conditional expression. It is written in Golang and uses the terraform-plugin-framework package.

Requirements

  • Terraform v1.0+
  • Golang 1.16+ (for building the provider)

Installation

  1. Clone the repository and build the provider:
git clone https://github.com/yourusername/terraform-dynamodb-ami-provider.git
cd terraform-provider-amidynamodb
go build -o terraform-provider-amidynamodb

mkdir -p ~/.terraform.d/plugins/yourusername/example/1.0.0/linux_amd64
mv terraform-provider-amidynamodb ~/.terraform.d/plugins/yourusername/example/1.0.0/linux_amd64

or

dowload from Terraform Registry: https://registry.terraform.io/providers/dyudin0821/amidynamodb

Usage

Provider Configuration

To configure the provider, you need to specify the AWS region:

provider "amidynamodb" {
  aws_region = "us-west-2"
}

Data Source: amidynamodb_get_item

This data source retrieves the AMI ID from a DynamoDB table based on the provided conditional expression.

Arguments:

  • table_name - (Required) The name of the DynamoDB table.
  • filter_expression - (Required) The conditional expression used to filter values from the DynamoDB table.
  • expression_attribute_values - (Optional) A map of attribute values used in the conditional expression.

Attributes:

  • ami_id - The AMI ID retrieved from the DynamoDB table.

Example:

data "amidynamodb_get_item" "example" {
  table_name = "ami-table"
  filter_expression = "latest = :latest"
  expression_attribute_values = {
    ":latest" = true
  }
}

About

This Terraform provider allows users to fetch AWS AMI IDs from a DynamoDB table using a custom filter expression. It simplifies the process of retrieving AMI IDs based on specific conditions, making it easier to manage and provision AWS resources.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages