Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate addon for elastic cloud #287

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: ""
creationTimestamp: null
labels:
type: terraform
name: elastic-deployment
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/puppetlabs/terraform-ec-deployment.git
providerRef:
name: elastic
namespace: default
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
status: {}
25 changes: 25 additions & 0 deletions addons/terraform-elastic/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: terraform-elastic
version: 1.0.0
description: Kubernetes Terraform Controller Provider for Elastic Cloud
url: https://github.com/oam-dev/terraform-controller

tags:
- Terraform Controller Provider
- IaC
- Cloud Resources

deployTo:
control_plane: true
runtime_cluster: false

dependencies:
- name: terraform


# When enabling a Terraform provider, these properties need to set for authentication. For Tencent Cloud,
# name: Environment variable name when authenticating Terraform, like https://github.com/oam-dev/terraform-controller/blob/master/controllers/provider/credentials.go#L59
# secretKey: Secret key when storing authentication information in a Kubernetes, like https://github.com/oam-dev/terraform-controller/blob/master/controllers/provider/credentials.go#L109.
cloudProperties:
- name: EC_API_KEY
secretKey: ecApiKey
description: Get EC_API_KEY per this guide https://www.elastic.co/guide/en/cloud-enterprise/current/ece-restful-api-authentication.html
3 changes: 3 additions & 0 deletions addons/terraform-elastic/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Addon terraform-elastic

This addon contains Terraform provider for Elastic Cloud.
18 changes: 18 additions & 0 deletions addons/terraform-elastic/resources/elastic-account-creds.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import "strings"

output: {
type: "raw"
properties: {
apiVersion: "v1"
kind: "Secret"
metadata: {
name: "elastic-account-creds"
namespace: "vela-system"
}
type: "Opaque"
stringData: credentials: strings.Join([
"ecApiKey: " + parameter.EC_API_KEY,
], "\n")
}
}

22 changes: 22 additions & 0 deletions addons/terraform-elastic/resources/elastic-provider.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
output: {
type: "raw"
properties: {
apiVersion: "terraform.core.oam.dev/v1beta1"
kind: "Provider"
metadata: {
name: "elastic"
namespace: "default"
}
spec: {
provider: "elastic"
credentials: {
source: "Secret"
secretRef: {
namespace: "vela-system"
name: "elastic-account-creds"
key: "credentials"
}
}
}
}
}
4 changes: 4 additions & 0 deletions addons/terraform-elastic/resources/parameter.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameter: {
//+usage=Get EC_API_KEY per this guide https://www.elastic.co/guide/en/cloud-enterprise/current/ece-restful-api-authentication.html
EC_API_KEY: *"" | string
}
5 changes: 5 additions & 0 deletions addons/terraform-elastic/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: terraform-elastic
namespace: vela-system