Skip to content

Commit 48c89b5

Browse files
authored
chore: added resource stack_associate and node + updated e2e-tests for docker swarm and edge portainer resources
1 parent 04e7f89 commit 48c89b5

62 files changed

Lines changed: 1501 additions & 69 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
body:
2+
- type: markdown
3+
attributes:
4+
value: |
5+
Before asking a question, make sure it hasn't been already asked and answered. You can search our [discussions](https://github.com/portainer/terraform-provider-portainer/discussions) and [bug reports](https://github.com/portainer/terraform-provider-portainer/issues) in GitHub. Also, be sure to check our [community Slack channel](https://app.slack.com/client/T2AGA35A4/C08NHK6PLUT) first.
6+
7+
- type: textarea
8+
attributes:
9+
label: Ask a Question!
10+
validations:
11+
required: true
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
body:
2+
- type: markdown
3+
attributes:
4+
value: |
5+
# Welcome!
6+
7+
Thanks for suggesting an idea for Portainer!
8+
9+
Before opening a new idea or feature request, make sure that we do not have any duplicates already open. You can ensure this by [searching this discussion cagetory](https://github.com/portainer/terraform-provider-portainer/discussions/categories/ideas). If there is a duplicate, please add a comment to the existing idea instead.
10+
11+
Also, be sure to check our [community Slack channel](https://app.slack.com/client/T2AGA35A4/C08NHK6PLUT) as they may point you toward a solution.
12+
13+
**DO NOT FILE DUPLICATE REQUESTS.**
14+
15+
- type: textarea
16+
attributes:
17+
label: Is your feature request related to a problem? Please describe
18+
description: Short list of what the feature request aims to address.
19+
validations:
20+
required: true
21+
- type: textarea
22+
attributes:
23+
label: Describe the solution you'd like
24+
description: A clear and concise description of what you want to happen.
25+
validations:
26+
required: true
27+
- type: textarea
28+
attributes:
29+
label: Describe alternatives you've considered
30+
description: A clear and concise description of any alternative solutions or features you've considered.
31+
validations:
32+
required: true
33+
- type: textarea
34+
attributes:
35+
label: Additional context
36+
description: Add any other context or screenshots about the feature request here.
37+
validations:
38+
required: false
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Bug Report
2+
description: Create a report to help us improve.
3+
labels: kind/bug,bug/need-confirmation
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
# Welcome!
9+
10+
The issue tracker is for reporting bugs. If you have an [idea for a new feature](https://github.com/portainer/terraform-provider-portainer/discussions/categories/ideas) or a [general question about Portainer Terraform provider](https://github.com/portainer/terraform-provider-portainer/discussions/categories/help) please post in our [GitHub Discussions](https://github.com/portainer/terraform-provider-portainer/discussions).
11+
12+
You can also ask for help in our [community Slack channel](https://app.slack.com/client/T2AGA35A4/C08NHK6PLUT).
13+
14+
Please note that we only provide support for current versions of Portainer.
15+
16+
**DO NOT FILE ISSUES FOR GENERAL SUPPORT QUESTIONS**.
17+
18+
- type: checkboxes
19+
id: terms
20+
attributes:
21+
label: Before you start please confirm the following.
22+
options:
23+
- label: Yes, I've searched similar issues on [GitHub](https://github.com/portainer/terraform-provider-portainer/issues).
24+
required: true
25+
- label: Yes, I've checked whether this issue is covered/solved in the Portainer Terraform provider [discussions](https://github.com/portainer/terraform-provider-portainer/discussions/categories/help).
26+
required: true
27+
28+
- type: markdown
29+
attributes:
30+
value: |
31+
# About your issue
32+
33+
Tell us a bit about the issue you're having.
34+
35+
- type: textarea
36+
attributes:
37+
label: Problem Description
38+
description: A clear and concise description of what the bug is.
39+
validations:
40+
required: true
41+
42+
- type: textarea
43+
attributes:
44+
label: Expected Behavior
45+
description: A clear and concise description of what you expected to happen.
46+
validations:
47+
required: true
48+
49+
- type: textarea
50+
attributes:
51+
label: Actual Behavior
52+
description: A clear and concise description of what actually happens.
53+
validations:
54+
required: true
55+
56+
- type: textarea
57+
attributes:
58+
label: Steps to Reproduce
59+
description: Please be as detailed as possible when providing steps to reproduce.
60+
placeholder: |
61+
1. Write a minimal Terraform config
62+
2. Run `terraform apply`
63+
3. Observe the error output
64+
validations:
65+
required: true
66+
67+
- type: textarea
68+
attributes:
69+
label: Logs / Screenshots / Terraform Output
70+
description: Provide relevant logs or output from Terraform plan/apply, Portainer logs, or any screenshots related to the issue.
71+
validations:
72+
required: true
73+
74+
- type: input
75+
attributes:
76+
label: Affected Resource(s)
77+
description: |
78+
Name(s) of the resource(s) that are causing the issue. Example: portainer_stack, portainer_environment
79+
validations:
80+
required: true
81+
82+
- type: input
83+
attributes:
84+
label: Terraform Command Used
85+
description: |
86+
The Terraform CLI command that triggered the issue. Example: terraform apply
87+
validations:
88+
required: true
89+
90+
- type: textarea
91+
attributes:
92+
label: Relevant Terraform Configuration
93+
description: |
94+
Provide the Terraform configuration (HCL) that triggers the bug. You can redact sensitive values.
95+
render: hcl
96+
validations:
97+
required: false
98+
99+
- type: markdown
100+
attributes:
101+
value: |
102+
# About your environment
103+
104+
Tell us a bit about your Portainer and Terraform environment.
105+
106+
- type: input
107+
attributes:
108+
label: Provider Version
109+
description: |
110+
Version of the terraform-provider-portainer. Example: v0.6.0
111+
validations:
112+
required: true
113+
114+
- type: input
115+
attributes:
116+
label: Terraform Version
117+
description: |
118+
Version of Terraform. Example: 1.7.5
119+
validations:
120+
required: true
121+
122+
- type: input
123+
attributes:
124+
label: Portainer Version
125+
description: |
126+
Version of the Portainer instance you are using. Example: 2.20.3
127+
validations:
128+
required: true
129+
130+
- type: input
131+
attributes:
132+
label: Platform and Version
133+
description: |
134+
Enter your container management platform (Docker | Swarm | Kubernetes) along with the version.
135+
Example: Docker 24.0.3 | Kubernetes 1.26
136+
validations:
137+
required: false
138+
139+
- type: input
140+
attributes:
141+
label: OS and Architecture
142+
description: |
143+
Enter your Operating System, Version and Architecture. Example: Ubuntu 22.04, AMD64 | Raspbian OS, ARM64
144+
validations:
145+
required: true
146+
147+
- type: textarea
148+
attributes:
149+
label: Additional Information
150+
description: |
151+
Any additional information about your environment, the bug, or anything else you think might be helpful.
152+
validations:
153+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Question
4+
url: https://github.com/portainer/terraform-provider-portainer/discussions/new?category=help
5+
about: Ask us a question about Portainer usage or deployment.
6+
- name: Idea or Feature Request
7+
url: https://github.com/portainer/terraform-provider-portainer/discussions/new?category=ideas
8+
about: Suggest an idea or feature/enhancement that should be added in Portainer.
9+
- name: Community Slack channel
10+
url: https://app.slack.com/client/T2AGA35A4/C08NHK6PLUT
11+
about: Check our community Slack channel.

.github/workflows/daily-e2e-test.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,17 @@ jobs:
5252
terraform fmt -check
5353
terraform apply -auto-approve
5454
55+
- name: 🧽 Run Terraform E2E tests - Apply Portainer settings
56+
run: |
57+
cd e2e-tests/settings
58+
terraform init -input=false
59+
terraform fmt -check
60+
terraform apply -auto-approve
61+
5562
- name: 🧪 Run Terraform E2E tests
5663
run: |
57-
APPLY_ONLY_DIRS=("stack" "webhook" "container_exec" "backup" "auth" "settings" "open_amt" "endpoint_snapshot" "endpoint_settings" "kubernetes_namespace")
58-
FULL_CYCLE_DIRS=("kubernetes_application" "kubernetes_clusterrole" "kubernetes_clusterrolebinding" "kubernetes_configmaps" "kubernetes_cronjob" "kubernetes_helm" "kubernetes_ingress" "kubernetes_ingresscontrollers" "kubernetes_job" "kubernetes_namespace_ingresscontrollers" "kubernetes_namespace_system" "kubernetes_role" "kubernetes_rolebinding" "kubernetes_secret" "kubernetes_service" "kubernetes_serviceaccounts" "kubernetes_storage" "kubernetes_volume"
64+
APPLY_ONLY_DIRS=("stack" "webhook" "container_exec" "backup" "auth" "open_amt" "kubernetes_role" "kubernetes_delete_object" "endpoint_snapshot" "endpoint_settings" "kubernetes_namespace")
65+
FULL_CYCLE_DIRS=("edge" "kubernetes_application" "kubernetes_clusterrole" "kubernetes_clusterrolebinding" "kubernetes_configmaps" "kubernetes_cronjob" "kubernetes_helm" "kubernetes_ingress" "kubernetes_ingresscontrollers" "kubernetes_job" "kubernetes_namespace_ingresscontrollers" "kubernetes_namespace_system" "kubernetes_role" "kubernetes_rolebinding" "kubernetes_secret" "kubernetes_service" "kubernetes_serviceaccounts" "kubernetes_storage" "kubernetes_volume"
5966
"custom_template" "docker_image" "docker_network" "docker_volume" "stack" "endpoint_group" "tag" "user-team-teammembership" "registry")
6067
6168
for dir in "${FULL_CYCLE_DIRS[@]}"; do
@@ -88,6 +95,40 @@ jobs:
8895
cd e2e-tests/environment
8996
terraform destroy -auto-approve
9097
98+
- name: 🐳 Init Docker Swarm
99+
run: make swarm-init
100+
101+
- name: 🧪 Run Terraform E2E tests specific for swarm
102+
run: |
103+
SWARM_RESOURCES_FULL_CYCLE=("docker_config" "docker_secret")
104+
SWARM_RESOURCES_BASIC_CYCLE=("endpoint_swarm_stack" "endpoint_service_update")
105+
106+
for dir in "${SWARM_RESOURCES_FULL_CYCLE[@]}"; do
107+
if [ -d "e2e-tests/$dir" ]; then
108+
echo "▶️ Running full Terraform cycle in e2e-tests/$dir (Swarm)"
109+
cd "e2e-tests/$dir"
110+
terraform init -input=false
111+
terraform fmt -check
112+
terraform validate
113+
terraform apply -auto-approve
114+
terraform destroy -auto-approve
115+
cd -
116+
fi
117+
done
118+
119+
for dir in "${SWARM_RESOURCES_BASIC_CYCLE[@]}"; do
120+
if [ -d "e2e-tests/$dir" ]; then
121+
echo "▶️ Running full Terraform cycle in e2e-tests/$dir (Swarm)"
122+
cd "e2e-tests/$dir"
123+
terraform init -input=false
124+
terraform fmt -check
125+
terraform validate
126+
terraform apply -auto-approve
127+
cd -
128+
sleep 20
129+
fi
130+
done
131+
91132
- name: 🧪 Run Terraform E2E tests - Added SSL for Portainer
92133
run: |
93134
cd e2e-tests/ssl

.github/workflows/pr-e2e-test.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ jobs:
6060
terraform fmt -check
6161
terraform apply -auto-approve
6262
63+
- name: 🧽 Run Terraform E2E tests - Apply Portainer settings
64+
run: |
65+
cd e2e-tests/settings
66+
terraform init -input=false
67+
terraform fmt -check
68+
terraform apply -auto-approve
69+
6370
- name: 🧪 Run Terraform E2E tests
6471
run: |
65-
APPLY_ONLY_DIRS=("stack" "webhook" "container_exec" "backup" "auth" "settings" "open_amt" "endpoint_snapshot" "endpoint_settings" "kubernetes_namespace")
66-
FULL_CYCLE_DIRS=("kubernetes_application" "kubernetes_clusterrole" "kubernetes_clusterrolebinding" "kubernetes_configmaps" "kubernetes_cronjob" "kubernetes_helm" "kubernetes_ingress" "kubernetes_ingresscontrollers" "kubernetes_job" "kubernetes_namespace_ingresscontrollers" "kubernetes_namespace_system" "kubernetes_role" "kubernetes_rolebinding" "kubernetes_secret" "kubernetes_service" "kubernetes_serviceaccounts" "kubernetes_storage" "kubernetes_volume"
72+
APPLY_ONLY_DIRS=("stack" "webhook" "container_exec" "backup" "auth" "open_amt" "kubernetes_role" "kubernetes_delete_object" "endpoint_snapshot" "endpoint_settings" "kubernetes_namespace")
73+
FULL_CYCLE_DIRS=("edge" "kubernetes_application" "kubernetes_clusterrole" "kubernetes_clusterrolebinding" "kubernetes_configmaps" "kubernetes_cronjob" "kubernetes_helm" "kubernetes_ingress" "kubernetes_ingresscontrollers" "kubernetes_job" "kubernetes_namespace_ingresscontrollers" "kubernetes_namespace_system" "kubernetes_role" "kubernetes_rolebinding" "kubernetes_secret" "kubernetes_service" "kubernetes_serviceaccounts" "kubernetes_storage" "kubernetes_volume"
6774
"custom_template" "docker_image" "docker_network" "docker_volume" "stack" "endpoint_group" "tag" "user-team-teammembership" "registry")
6875
6976
for dir in "${FULL_CYCLE_DIRS[@]}"; do
@@ -96,6 +103,40 @@ jobs:
96103
cd e2e-tests/environment
97104
terraform destroy -auto-approve
98105
106+
- name: 🐳 Init Docker Swarm
107+
run: make swarm-init
108+
109+
- name: 🧪 Run Terraform E2E tests specific for swarm
110+
run: |
111+
SWARM_RESOURCES_FULL_CYCLE=("docker_config" "docker_secret")
112+
SWARM_RESOURCES_BASIC_CYCLE=("endpoint_swarm_stack" "endpoint_service_update")
113+
114+
for dir in "${SWARM_RESOURCES_FULL_CYCLE[@]}"; do
115+
if [ -d "e2e-tests/$dir" ]; then
116+
echo "▶️ Running full Terraform cycle in e2e-tests/$dir (Swarm)"
117+
cd "e2e-tests/$dir"
118+
terraform init -input=false
119+
terraform fmt -check
120+
terraform validate
121+
terraform apply -auto-approve
122+
terraform destroy -auto-approve
123+
cd -
124+
fi
125+
done
126+
127+
for dir in "${SWARM_RESOURCES_BASIC_CYCLE[@]}"; do
128+
if [ -d "e2e-tests/$dir" ]; then
129+
echo "▶️ Running full Terraform cycle in e2e-tests/$dir (Swarm)"
130+
cd "e2e-tests/$dir"
131+
terraform init -input=false
132+
terraform fmt -check
133+
terraform validate
134+
terraform apply -auto-approve
135+
cd -
136+
sleep 20
137+
fi
138+
done
139+
99140
- name: 🧪 Run Terraform E2E tests - Added SSL for Portainer
100141
run: |
101142
cd e2e-tests/ssl

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ help:
2020
@echo " up Start Docker Compose services"
2121
@echo " launch Open https://localhost:9000 in default browser"
2222
@echo " down Stop Docker Compose services"
23+
@echo " swarm-init Initialize Docker Swarm (if not already active)"
24+
@echo " swarm-leave Leave Docker Swarm (forcefully, if active)"
2325
@echo " up-agent Start Portainer Agent via docker-compose.agent.yml"
2426
@echo " down-agent Stop Portainer Agent"
2527
@echo " install-k3d Install k3d CLI"
@@ -152,6 +154,16 @@ up-agent:
152154
down-agent:
153155
docker compose -f docker-compose.agent.yml down
154156

157+
.PHONY: swarm-init
158+
swarm-init:
159+
@echo "🚀 Initializing Docker Swarm (if not already active)..."
160+
@docker info | grep -q "Swarm: active" || docker swarm init || true
161+
162+
.PHONY: swarm-leave
163+
swarm-leave:
164+
@echo "🧹 Leaving Docker Swarm (if active)..."
165+
@docker info | grep -q "Swarm: active" && docker swarm leave --force || echo "No Swarm to leave."
166+
155167
### Kubernetes / k3d
156168
.PHONY: install-k3d
157169
install-k3d:

0 commit comments

Comments
 (0)