Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/terraform/customize/plan-modification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: "Plan Modification"
description: "Learn how to customize Terraform plan behavior."
---

import { Callout } from "@/mdx/components";

# Plan Modification

## Custom Attribute Plan Modification
Expand All @@ -25,7 +27,9 @@ components:
x-speakeasy-plan-modifiers: AgeModifier
```

In this scenario, when Speakeasy next generates the Terraform provider, it will bootstrap a custom plan modifier file, located at `internal/planmodifiers/int64planmodifier/age_modifier.go`, and import the schema configuration wherever `x-speakeasy-plan-modifiers: AgeModifier` is referenced.
<Callout title="Note" type="info">
Once you've added the `x-speakeasy-plan-modifiers` extension with a modifier, Speakeasy's next Terraform provider generation will bootstrap a custom plan modifier file. Using the previous YAML snippet as an example, the modifier will be located at `internal/planmodifiers/int64planmodifier/age_modifier.go`, and import the schema configuration wherever `x-speakeasy-plan-modifiers: AgeModifier` is referenced.
</Callout>

The `x-speakeasy-plan-modifiers` extension supports an array of names as well, such as:

Expand All @@ -37,8 +41,6 @@ x-speakeasy-plan-modifiers:

### Implementation Notes

### Implementation notes

A plan modifier is a type that implements the plan modifier interface defined by the `terraform-plugin-framework`. A unique plan modifier is bootstrapped in the appropriate subfolder for the Terraform type that it is applied to, which is usually one of the following:

- `boolplanmodifiers`
Expand Down
7 changes: 5 additions & 2 deletions docs/terraform/customize/validation-dependencies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: |
Add custom validation logic and manage attribute dependencies in Terraform providers.
---

import { Callout } from "@/mdx/components";

# Validation and Dependencies

## Prevent Conflicting Attributes
Expand Down Expand Up @@ -163,8 +165,9 @@ components:
type: integer
x-speakeasy-plan-validators: AgeValidator
```

In this scenario, when Speakeasy next generates the Terraform provider, it will bootstrap a custom validator file located at `internal/validators/int64validators/age_validator.go`, and import the schema configuration wherever `x-speakeasy-plan-validators: AgeValidator` is referenced. You can modify the validator file to contain your logic.
<Callout title="Note" type="info">
Once you've added the `x-speakeasy-plan-validators` extension with a modifier, Speakeasy's next Terraform provider generation will bootstrap a custom validator file. Using the previous YAML snippet as an example, the modifier will be located at `internal/validators/int64validators/age_validator.go`, and import the schema configuration wherever `x-speakeasy-plan-validators: AgeValidator` is referenced. You can modify the validator file to contain your logic.
</Callout>

#### Implementation Notes

Expand Down
Loading