rename integration provider to provider_type

"provider" is a reserved attribute name in Terraform.
This commit is contained in:
Graham McIntire 2026-03-13 17:41:06 -05:00
parent 4960adaf37
commit 3ff5ea41b3
No known key found for this signature in database
5 changed files with 13 additions and 13 deletions

View file

@ -137,7 +137,7 @@ output "agent_token" {
```terraform ```terraform
resource "towerops_integration" "pagerduty" { resource "towerops_integration" "pagerduty" {
provider = "pagerduty" provider_type = "pagerduty"
enabled = true enabled = true
} }
``` ```

View file

@ -14,7 +14,7 @@ Manages a TowerOps integration with third-party services such as PagerDuty, Slac
```terraform ```terraform
resource "towerops_integration" "pagerduty" { resource "towerops_integration" "pagerduty" {
provider = "pagerduty" provider_type ="pagerduty"
enabled = true enabled = true
} }
``` ```
@ -33,7 +33,7 @@ resource "towerops_integration" "webhook" {
```terraform ```terraform
resource "towerops_integration" "slack" { resource "towerops_integration" "slack" {
provider = "slack" provider_type ="slack"
enabled = false enabled = false
} }
``` ```
@ -42,7 +42,7 @@ resource "towerops_integration" "slack" {
### Required ### Required
- `provider` (String) - The integration provider type (e.g. `pagerduty`, `slack`, `webhook`). - `provider_type` (String) - The integration provider type (e.g. `pagerduty`, `slack`, `webhook`).
### Optional ### Optional

View file

@ -71,7 +71,7 @@ resource "towerops_agent" "remote" {
# Create an integration # Create an integration
resource "towerops_integration" "pagerduty" { resource "towerops_integration" "pagerduty" {
provider = "pagerduty" provider_type = "pagerduty"
enabled = true enabled = true
} }

View file

@ -1,5 +1,5 @@
resource "towerops_integration" "pagerduty" { resource "towerops_integration" "pagerduty" {
provider = "pagerduty" provider_type = "pagerduty"
enabled = true enabled = true
sync_interval_minutes = 5 sync_interval_minutes = 5
} }

View file

@ -25,7 +25,7 @@ type IntegrationResource struct {
// IntegrationResourceModel describes the resource data model. // IntegrationResourceModel describes the resource data model.
type IntegrationResourceModel struct { type IntegrationResourceModel struct {
ID types.String `tfsdk:"id"` ID types.String `tfsdk:"id"`
Provider types.String `tfsdk:"provider"` ProviderType types.String `tfsdk:"provider_type"`
Enabled types.Bool `tfsdk:"enabled"` Enabled types.Bool `tfsdk:"enabled"`
SyncIntervalMinutes types.Int64 `tfsdk:"sync_interval_minutes"` SyncIntervalMinutes types.Int64 `tfsdk:"sync_interval_minutes"`
InsertedAt types.String `tfsdk:"inserted_at"` InsertedAt types.String `tfsdk:"inserted_at"`
@ -51,7 +51,7 @@ func (r *IntegrationResource) Schema(ctx context.Context, req resource.SchemaReq
stringplanmodifier.UseStateForUnknown(), stringplanmodifier.UseStateForUnknown(),
}, },
}, },
"provider": schema.StringAttribute{ "provider_type": schema.StringAttribute{
Description: "The integration provider type (e.g. pagerduty, slack, webhook).", Description: "The integration provider type (e.g. pagerduty, slack, webhook).",
Required: true, Required: true,
}, },
@ -102,7 +102,7 @@ func (r *IntegrationResource) Create(ctx context.Context, req resource.CreateReq
} }
integration := integrationWithCredentials{ integration := integrationWithCredentials{
Provider: data.Provider.ValueString(), Provider: data.ProviderType.ValueString(),
} }
if !data.Enabled.IsNull() { if !data.Enabled.IsNull() {
@ -152,7 +152,7 @@ func (r *IntegrationResource) Read(ctx context.Context, req resource.ReadRequest
return return
} }
data.Provider = types.StringValue(integration.Provider) data.ProviderType = types.StringValue(integration.Provider)
data.InsertedAt = types.StringValue(integration.InsertedAt) data.InsertedAt = types.StringValue(integration.InsertedAt)
if integration.Enabled != nil { if integration.Enabled != nil {
@ -176,7 +176,7 @@ func (r *IntegrationResource) Update(ctx context.Context, req resource.UpdateReq
} }
integration := integrationWithCredentials{ integration := integrationWithCredentials{
Provider: data.Provider.ValueString(), Provider: data.ProviderType.ValueString(),
} }
if !data.Enabled.IsNull() { if !data.Enabled.IsNull() {
@ -212,7 +212,7 @@ func (r *IntegrationResource) Update(ctx context.Context, req resource.UpdateReq
return return
} }
data.Provider = types.StringValue(updated.Provider) data.ProviderType = types.StringValue(updated.Provider)
if updated.Enabled != nil { if updated.Enabled != nil {
data.Enabled = types.BoolValue(*updated.Enabled) data.Enabled = types.BoolValue(*updated.Enabled)