terraform-provider-stackgen

sg_guild_integration (Resource)

⚠️ Experimental — This resource is part of the Guild platform and may change in future releases.

Manages a guild-level integration connecting agents to an external system (e.g. MCP servers, Salesforce, Jira). Integrations are registered at the guild level and can be attached to one or more agents. Import by integration name; import requires Guild GET to return its configuration and ID.

Example Usage

# When to use: Register a tool integration (MCP, Grafana, Jira, AWS, …) that
# agents and knowledge sources can attach by name. Create secrets / credential
# providers first when the integration needs credentials.
#
# Prerequisites: optional sg_secret IDs (secret_ref_ids) or
# sg_credential_provider (credential_provider_id) for OAuth.
#
# Related: sg_agent.integrations, sg_knowledge_source.integration_name,
# sg_app.integrations (SRE app bindings), data.sg_guild_integration (lookup).
#
# MCP-style integration — add secret_ref_ids when the integration needs static credentials.
resource "sg_guild_integration" "example" {
  name        = "prod-github-mcp"
  description = "GitHub MCP server for repository automation."
  type        = "mcp"
  enabled     = true
}
# When to use: Prefer this over static secret_ref_ids when the vendor supports
# 3-legged OAuth (GitHub App, Salesforce, …). Create sg_credential_provider first.
#
# Integration using a 3-legged OAuth credential provider (see sg_credential_provider).
resource "sg_guild_integration" "oauth_example" {
  name                   = "github-app-integration"
  description            = "Uses dynamic OAuth tokens from a credential provider."
  type                   = "mcp"
  enabled                = true
  credential_provider_id = "00000000-0000-4000-8000-000000000002" # replace with sg_credential_provider.*.id
}

Import

Import an existing sg_guild_integration using its integration name:

terraform import sg_guild_integration.example 'example-grafana'

Operational notes

Create always checks the scoped integration name before upsert. If the name exists, strict mode fails; with adoption enabled only matching configured fields can be adopted without writing. A concurrent create between GET and upsert still requires backend conditional-create support. secret_ref_ids links Vault secrets; credential_provider_id links an OAuth credential provider. Provision credentials first. Integration env and secret references may expose sensitive connection metadata in Terraform state; secure state and plans.

Schema

Required

Optional

Nested Schema for image

Optional: