-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add gcp provider and generate addon (#245)
* add gcp provider and generate addon Signed-off-by: Nicola115 <[email protected]> * Update hack/addons/terraform/provider-GCP.yaml Co-authored-by: Zheng Xi Zhou <[email protected]> * Update hack/addons/terraform/provider-GCP.yaml Co-authored-by: Zheng Xi Zhou <[email protected]> Co-authored-by: Zheng Xi Zhou <[email protected]>
- Loading branch information
Showing
7 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: terraform-gcp | ||
version: 1.0.0 | ||
description: Kubernetes Terraform Controller Provider for Google Cloud Platform | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Addon terraform-gcp | ||
|
||
This addon contains Terraform provider for Google Cloud Platform. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import "strings" | ||
|
||
output: { | ||
type: "raw" | ||
properties: { | ||
apiVersion: "v1" | ||
kind: "Secret" | ||
metadata: { | ||
name: "gcp-account-creds" | ||
namespace: "vela-system" | ||
} | ||
type: "Opaque" | ||
stringData: credentials: strings.Join([ | ||
"gcpCredentialsJSON: " + parameter.GOOGLE_CREDENTIALS, | ||
|
||
"gcpProject: " + parameter.GOOGLE_PROJECT, | ||
], "\n") | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
parameter: { | ||
//+usage=Get gcpCredentialsJSON per this guide https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#adding-credentials | ||
GOOGLE_CREDENTIALS: *"" | string | ||
//+usage=Get GOOGLE_REGION by picking one RegionId from Google Cloud region list https://cloud.google.com/compute/docs/regions-zones | ||
GOOGLE_REGION: *"" | string | ||
//+usage=Set gcpProject per this guide https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#configuring-the-provider | ||
GOOGLE_PROJECT: *"" | string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
output: { | ||
type: "raw" | ||
properties: { | ||
apiVersion: "terraform.core.oam.dev/v1beta1" | ||
kind: "Provider" | ||
metadata: { | ||
name: "gcp" | ||
namespace: "default" | ||
} | ||
spec: { | ||
provider: "gcp" | ||
region: parameter.GOOGLE_REGION | ||
credentials: { | ||
source: "Secret" | ||
secretRef: { | ||
namespace: "vela-system" | ||
name: "gcp-account-creds" | ||
key: "credentials" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: core.oam.dev/v1beta1 | ||
kind: Application | ||
metadata: | ||
name: terraform-gcp | ||
namespace: vela-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# provider name | ||
name: gcp | ||
|
||
# The Cloud name of the provider | ||
cloudName: Google Cloud Platform | ||
|
||
# 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. | ||
properties: | ||
- name: GOOGLE_CREDENTIALS | ||
secretKey: gcpCredentialsJSON | ||
description: Get GOOGLE_CREDENTIALS per this guide https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#adding-credentials | ||
- name: GOOGLE_REGION | ||
description: Get GOOGLE_REGION by picking one RegionId from Google Cloud region list https://cloud.google.com/compute/docs/regions-zones | ||
isRegion: true | ||
- name: GOOGLE_PROJECT | ||
secretKey: gcpProject | ||
description: Set GOOGLE_PROJECT per this guide https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#configuring-the-provider |