Skip to content

feat: add ai configs resources #1075

feat: add ai configs resources

feat: add ai configs resources #1075

Workflow file for this run

# Terraform Provider testing workflow.
name: Test
on:
pull_request: # this is for external contributions/forks. we have a check in place to ensure an LD user explicitly allows the tests to run for forks.
push:
branches: [main]
schedule: # runs tests once a day on the main branch
- cron: "0 0 * * *"
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.sha}}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: "go.mod"
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: v1.64.8
install-mode: goinstall
generate:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: aws-actions/configure-aws-credentials@f24d7193d98baebaeacc7e2227925dd47cc267f5 # v4.2.0
with:
audience: https://github.com/launchdarkly
aws-region: us-east-1
role-to-assume: arn:aws:iam::061661829416:role/github-actions-terraform-provider-launchdarkly
role-session-name: GitHubActionsGenerate_run-${{ github.run_id }}
- id: get-launchdarkly-access-token
uses: dkershner6/aws-ssm-getparameters-action@4fcb4872421f387a6c43058473acc1b22443fe13 # v2.0.3
with:
parameterPairs: |
/global/services/github/terraform-provider/launchdarkly-access-token = LAUNCHDARKLY_ACCESS_TOKEN
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: "go.mod"
cache: true
# We need the latest version of Terraform for our documentation generation to use
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false
- run: make generate
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Acceptance Tests
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
id-token: write
contents: read
env:
TF_ACC: "1"
strategy:
matrix:
test_case:
- TestAccAIConfig_
- TestAccAIConfigVariation
- TestAccAITool
- TestAccDataSource
- TestAccAccessToken
- TestAccAuditLogSubscription
- TestAccCustomRole
- TestAccDestination
- TestAccEnvironment
- TestAccFeatureFlag_
- TestAccFeatureFlagEnvironment
- TestAccFlagTemplates
- TestAccFlagTrigger
- TestAccMetric
- TestAccModelConfig
- TestAccProject
- TestAccRelayProxy
- TestAccSegment
- TestAccTeamMember_CreateGeneric
- TestAccTeamMember_UpdateGeneric
- TestAccTeamMember_CreateWithCustomRole
- TestAccTeamMember_UpdateWithCustomRole
- TestAccTeam_
- TestAccTeamRoleMapping_
- TestAccView
- TestAccWebhook
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: aws-actions/configure-aws-credentials@f24d7193d98baebaeacc7e2227925dd47cc267f5 # v4.2.0
with:
audience: https://github.com/launchdarkly
aws-region: us-east-1
role-to-assume: arn:aws:iam::061661829416:role/github-actions-terraform-provider-launchdarkly
role-session-name: GitHubActionsTest_run-${{ github.run_id }}
- id: get-launchdarkly-access-token
uses: dkershner6/aws-ssm-getparameters-action@4fcb4872421f387a6c43058473acc1b22443fe13 # v2.0.3
with:
parameterPairs: |
/global/services/github/terraform-provider/launchdarkly-access-token = LAUNCHDARKLY_ACCESS_TOKEN
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: "go.mod"
- run: go mod download
- name: Run Test
run: |
echo "Running test case: ${{ matrix.test_case }}"
TESTARGS="-run ${{ matrix.test_case }}" make testacc-with-retry
check-success:
name: Check Success
needs:
- build
- generate
- test
if: always()
runs-on: ubuntu-latest
steps:
- name: Evaluate results
run: |
if printf '${{ toJSON(needs) }}' | grep --quiet --extended-regexp --ignore-case '"result": "(failure|cancelled)"'; then
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
exit 1
fi
notify-slack-on-failure:
name: Notify Slack on Failures
if: failure() && github.ref == 'refs/heads/main'
needs:
- build
- generate
- test
runs-on: ubuntu-latest
steps:
- name: Send GitHub trigger payload to Slack Workflow Builder
id: slack
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
payload-delimiter: "_"
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger