Skip to content

Commit e547f46

Browse files
committed
Merge branch 'main' of github.com:togish/terraform-provider-elasticstack into indextemplate-component-ignore-missing
2 parents 783b359 + 235ca2f commit e547f46

File tree

21 files changed

+1422
-10
lines changed

21 files changed

+1422
-10
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16+
copilot-setup-steps:
17+
runs-on: ubuntu-latest
18+
19+
# Set the permissions to the lowest permissions possible needed for your steps.
20+
# Copilot will be given its own token for its operations.
21+
permissions:
22+
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
23+
contents: read
24+
env:
25+
ELASTICSEARCH_ENDPOINTS: "http://localhost:9200"
26+
ELASTICSEARCH_USERNAME: "elastic"
27+
ELASTICSEARCH_PASSWORD: password
28+
KIBANA_ENDPOINT: "http://localhost:5601"
29+
KIBANA_USERNAME: "elastic"
30+
KIBANA_PASSWORD: password
31+
KIBANA_SYSTEM_USERNAME: kibana_system
32+
KIBANA_SYSTEM_PASSWORD: password
33+
TF_ACC: "1"
34+
services:
35+
elasticsearch:
36+
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.3
37+
env:
38+
discovery.type: single-node
39+
xpack.security.enabled: true
40+
xpack.security.authc.api_key.enabled: true
41+
xpack.security.authc.token.enabled: true
42+
xpack.watcher.enabled: true
43+
xpack.license.self_generated.type: trial
44+
repositories.url.allowed_urls: https://example.com/*
45+
path.repo: /tmp
46+
ELASTIC_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
47+
ports:
48+
- 9200:9200
49+
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
50+
kibana:
51+
image: docker.elastic.co/kibana/kibana:9.0.3
52+
env:
53+
SERVER_NAME: kibana
54+
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
55+
ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
56+
ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
57+
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d
58+
# LOGGING_ROOT_LEVEL: debug
59+
ports:
60+
- 5601:5601
61+
options: --health-cmd="curl http://localhost:5601/api/status" --health-interval=10s --health-timeout=5s --health-retries=10
62+
fleet:
63+
image: docker.elastic.co/elastic-agent/elastic-agent:9.0.3
64+
env:
65+
SERVER_NAME: fleet
66+
FLEET_ENROLL: "1"
67+
FLEET_URL: https://fleet:8220
68+
FLEET_INSECURE: "true"
69+
FLEET_SERVER_ENABLE: "1"
70+
FLEET_SERVER_POLICY_ID: fleet-server
71+
FLEET_SERVER_ELASTICSEARCH_HOST: http://elasticsearch:9200
72+
FLEET_SERVER_ELASTICSEARCH_INSECURE: "true"
73+
FLEET_SERVER_INSECURE_HTTP: "true"
74+
KIBANA_HOST: http://kibana:5601
75+
KIBANA_FLEET_SETUP: "1"
76+
KIBANA_FLEET_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
77+
ports:
78+
- 8220:8220
79+
options: --restart="unless-stopped"
80+
81+
steps:
82+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
83+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
84+
with:
85+
go-version-file: 'go.mod'
86+
cache: true
87+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3
88+
with:
89+
terraform_wrapper: false
90+
91+
- name: Get dependencies
92+
run: make setup
93+
94+
- name: Setup Kibana user
95+
run: make set-kibana-password
96+
env:
97+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
98+
KIBANA_SYSTEM_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
99+
KIBANA_SYSTEM_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
100+
101+
- id: get-api-key
102+
name: Get ES API key
103+
run: |-
104+
echo "apikey=$(make create-es-api-key | jq -r .encoded)" >> "$GITHUB_OUTPUT"
105+
env:
106+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
107+
108+
- id: setup-fleet
109+
name: Setup Fleet
110+
run: |-
111+
make setup-kibana-fleet
112+
env:
113+
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
114+
FLEET_NAME: "fleet"

.windsurf/rules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* The project is a Terraform provider, written in Golang
2+
* The provider manages Elastic Stack resources
3+
* There is a mix of SDK, and plugin framework resources
4+
* New resources should be written with the Terraform plugin framework
5+
* Plugin framework resources should:
6+
* Follow the example set in /internal/elasticsearch/security/system_user
7+
* Be contained within their own module
8+
* Have the main concepts split across their own files
9+
* Include acceptance tests

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## [Unreleased]
22

3+
- Add `elasticstack_apm_agent_configuration` resource ([#1196](https://github.com/elastic/terraform-provider-elasticstack/pull/1196))
34
- Add support for `timeslice_metric_indicator` in `elasticstack_kibana_slo` ([#1195](https://github.com/elastic/terraform-provider-elasticstack/pull/1195))
45
- Add `elasticstack_elasticsearch_ingest_processor_reroute` data source ([#678](https://github.com/elastic/terraform-provider-elasticstack/issues/678))
56
- Add support for `supports_agentless` to `elasticstack_fleet_agent_policy` ([#1197](https://github.com/elastic/terraform-provider-elasticstack/pull/1197))

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ install: build ## Install built provider into the local terraform cache
246246

247247
.PHONY: tools
248248
tools: $(GOBIN) ## Download golangci-lint locally if necessary.
249-
@[[ -f $(GOBIN)/golangci-lint ]] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v2.2.1
249+
@[[ -f $(GOBIN)/golangci-lint ]] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v2.2.2
250250

251251
.PHONY: golangci-lint
252252
golangci-lint:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
subcategory: "Kibana"
3+
layout: ""
4+
page_title: "Elasticstack: elasticstack_apm_agent_configuration Resource"
5+
description: |-
6+
Creates or updates an APM agent configuration
7+
---
8+
9+
# Resource: elasticstack_apm_agent_configuration
10+
11+
Creates or updates an APM agent configuration. See https://www.elastic.co/docs/solutions/observability/apm/apm-agent-central-configuration
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "elasticstack" {
17+
elasticsearch {}
18+
}
19+
20+
resource "elasticstack_apm_agent_configuration" "test_config" {
21+
service_name = "my-service"
22+
service_environment = "production"
23+
agent_name = "go"
24+
settings = {
25+
"transaction_sample_rate" = "0.5"
26+
"capture_body" = "all"
27+
}
28+
}
29+
```
30+
31+
<!-- schema generated by tfplugindocs -->
32+
## Schema
33+
34+
### Required
35+
36+
- `service_name` (String) The name of the service.
37+
- `settings` (Map of String) Agent configuration settings.
38+
39+
### Optional
40+
41+
- `agent_name` (String) The agent name is used by the UI to determine which settings to display.
42+
- `service_environment` (String) The environment of the service.
43+
44+
### Read-Only
45+
46+
- `id` (String) Internal identifier of the resource.
47+
48+
## Import
49+
50+
Import is supported using the following syntax:
51+
52+
```shell
53+
terraform import elasticstack_apm_agent_configuration.test_configuration my-service:production
54+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import elasticstack_apm_agent_configuration.test_configuration my-service:production
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
provider "elasticstack" {
2+
elasticsearch {}
3+
}
4+
5+
resource "elasticstack_apm_agent_configuration" "test_config" {
6+
service_name = "my-service"
7+
service_environment = "production"
8+
agent_name = "go"
9+
settings = {
10+
"transaction_sample_rate" = "0.5"
11+
"capture_body" = "all"
12+
}
13+
}

0 commit comments

Comments
 (0)