Skip to content

Commit b211553

Browse files
authored
Add all resources to local-dev Terraform code (#244)
1 parent 1d82878 commit b211553

File tree

9 files changed

+134
-18
lines changed

9 files changed

+134
-18
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ terraform-provider-argocd
66
# Env variables settings
77
/scripts/testacc
88
/scripts/testacc_prepare_env
9+
10+
# debug build
11+
__debug_bin

manifests/local-dev/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.terraform*
22
terraform.tfstate*
33
crash.log
4-
4+
*-config

manifests/local-dev/application.tf

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
resource "argocd_application" "foo" {
2+
metadata {
3+
name = "foo"
4+
namespace = "argocd"
5+
labels = {
6+
acceptance = "true"
7+
}
8+
annotations = {
9+
"this.is.a.really.long.nested.key" = "yes, really!"
10+
}
11+
}
12+
13+
spec {
14+
project = argocd_project.foo.metadata[0].name
15+
16+
source {
17+
repo_url = "https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami"
18+
chart = "redis"
19+
target_revision = "16.9.11"
20+
21+
helm {
22+
release_name = "testing"
23+
24+
parameter {
25+
name = "image.tag"
26+
value = "6.2.5"
27+
}
28+
29+
parameter {
30+
name = "architecture"
31+
value = "standalone"
32+
}
33+
}
34+
}
35+
36+
destination {
37+
server = "https://kubernetes.default.svc"
38+
namespace = "default"
39+
}
40+
41+
sync_policy {
42+
automated {
43+
prune = true
44+
self_heal = true
45+
allow_empty = false
46+
}
47+
48+
sync_options = [
49+
"PrunePropagationPolicy=foreground",
50+
"ApplyOutOfSyncOnly=true"
51+
]
52+
53+
retry {
54+
limit = 5
55+
backoff {
56+
duration = "3m"
57+
factor = "2"
58+
max_duration = "30m"
59+
}
60+
}
61+
}
62+
}
63+
64+
# wait = true
65+
}

manifests/local-dev/cluster.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
resource "kind_cluster" "secondary" {
2+
name = "secondary"
3+
node_image = "kindest/node:v1.24.7"
4+
}
5+
6+
resource "argocd_cluster" "kind_secondary" {
7+
server = kind_cluster.secondary.endpoint
8+
9+
config {
10+
tls_client_config {
11+
ca_data = kind_cluster.secondary.cluster_ca_certificate
12+
// insecure = true
13+
}
14+
}
15+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "argocd_project_token" "long" {
2+
project = argocd_project.foo.metadata.0.name
3+
role = "foo"
4+
description = "long lived token"
5+
}
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
terraform {
2-
required_providers {
3-
argocd = {
4-
source = "oboukili/argocd"
5-
version = "1.1.3"
6-
// version = "0.4.8"
7-
}
8-
}
9-
}
10-
11-
provider "argocd" {
12-
server_addr = "127.0.0.1:8080"
13-
insecure = true
14-
username = "admin"
15-
password = "acceptancetesting"
16-
}
17-
181
resource "argocd_project" "foo" {
192
metadata {
203
name = "foo"
@@ -35,29 +18,44 @@ resource "argocd_project" "foo" {
3518
server = "https://kubernetes.default.svc"
3619
namespace = "default"
3720
}
21+
3822
destination {
3923
server = "https://kubernetes.default.svc"
4024
namespace = "foo"
4125
}
26+
4227
cluster_resource_whitelist {
4328
group = "rbac.authorization.k8s.io"
4429
kind = "ClusterRoleBinding"
4530
}
31+
4632
cluster_resource_whitelist {
4733
group = "rbac.authorization.k8s.io"
4834
kind = "ClusterRole"
4935
}
36+
5037
namespace_resource_blacklist {
5138
group = "networking.k8s.io"
5239
kind = "Ingress"
5340
}
41+
5442
namespace_resource_whitelist {
5543
group = "*"
5644
kind = "*"
5745
}
46+
47+
role {
48+
name = "foo"
49+
policies = [
50+
"p, proj:foo:foo, applications, get, foo/*, allow",
51+
"p, proj:foo:foo, applications, sync, foo/*, deny",
52+
]
53+
}
54+
5855
orphaned_resources {
5956
warn = true
6057
}
58+
6159
sync_window {
6260
kind = "allow"
6361
applications = ["api-*"]
@@ -67,6 +65,7 @@ resource "argocd_project" "foo" {
6765
schedule = "10 1 * * *"
6866
manual_sync = true
6967
}
68+
7069
sync_window {
7170
kind = "deny"
7271
applications = ["foo"]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "argocd_repository_credentials" "this" {
2+
url = "https://github.com/foo"
3+
username = "foo"
4+
password = "bar"
5+
}

manifests/local-dev/repository.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
resource "argocd_repository" "this" {
2+
repo = "https://github.com/oboukili/terraform-provider-argocd"
3+
}

manifests/local-dev/versions.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
terraform {
2+
required_providers {
3+
argocd = {
4+
source = "oboukili/argocd"
5+
version = ">= 5.0.0"
6+
}
7+
kind = {
8+
source = "unicell/kind"
9+
version = "0.0.2-u2"
10+
}
11+
}
12+
}
13+
14+
provider "argocd" {
15+
server_addr = "127.0.0.1:8080"
16+
insecure = true
17+
username = "admin"
18+
password = "acceptancetesting"
19+
}
20+
21+
provider "kind" {}

0 commit comments

Comments
 (0)