Skip to content

Commit

Permalink
add alicloud
Browse files Browse the repository at this point in the history
  • Loading branch information
knightXun committed Sep 9, 2020
1 parent 8559b7b commit ad69127
Show file tree
Hide file tree
Showing 14 changed files with 823 additions and 17 deletions.
392 changes: 392 additions & 0 deletions acre-aliyun-example.yaml

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion acre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ backup_type_mapping:
aws: s3
azure: abs
openstack: swift
alicloud: oss


######################
Expand Down Expand Up @@ -288,7 +289,7 @@ validation:
credentials:
- and
- ["mapfield", "accessKeyID"]
- ["mapfield", "secretAccessKey"]
- ["mapfield", "accessKeySecret"]
config:
- ["mapfield", "region"]
- ["mapfield", "zones", ["list"]]
Expand Down Expand Up @@ -386,6 +387,9 @@ validation:
swift:
credentials: (( iaas.openstack.credentials ))
config: (( return_true ))
oss:
credentials: (( iaas.alicloud.credentials ))
config: (( return_true ))
dns:
google-clouddns:
credentials: (( iaas.gcp.credentials ))
Expand Down
1 change: 1 addition & 0 deletions components/etcd/backupinfra/provider/oss/export.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bucketname: (( data.terraform.outputs.bucketName.value ))
42 changes: 42 additions & 0 deletions components/etcd/backupinfra/provider/oss/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

provider "alicloud" {
access_key = var.ACCESS_KEY
secret_key = var.SECRET_KEY
region = var.REGION
version = "=1.95.0"
}

//=====================================================================
//= S3 bucket
//=====================================================================

resource "alicloud_oss_bucket" "bucket" {
bucket_prefix = var.BUCKETNAME
region = var.REGION
force_destroy = true
tags = {
Name = var.LANDSCAPE
}
}

//=====================================================================
//= Output variables
//=====================================================================

output "bucketName" {
value = alicloud_oss_bucket.bucket.id
}

17 changes: 17 additions & 0 deletions components/etcd/backupinfra/provider/oss/tfvars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ACCESS_KEY: (( config.credentials.accessKeyID ))
SECRET_KEY: (( config.credentials.accessKeySecret ))
LANDSCAPE: (( landscape.name ))
39 changes: 39 additions & 0 deletions components/etcd/backupinfra/provider/oss/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
//
# Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

variable "ACCESS_KEY" {
description = "Alicloud Access Key"
type = string
}

variable "SECRET_KEY" {
description = "Alicloud Secret Key"
type = string
}

variable "REGION" {
description = "Region of the OSS bucket"
type = string
}

variable "BUCKETNAME" {
description = "Name of the bucket"
type = string
}

variable "LANDSCAPE" {
description = "Name of the Landscape (for tagging)"
type = string
}

4 changes: 4 additions & 0 deletions components/etcd/backupinfra/provider/oss/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
4 changes: 2 additions & 2 deletions components/etcd/backupinfra/provider/s3/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

provider "aws" {
provider "alicloud" {
access_key = var.ACCESS_KEY
secret_key = var.SECRET_KEY
region = var.REGION
Expand All @@ -23,7 +23,7 @@ provider "aws" {
//= S3 bucket
//=====================================================================

resource "aws_s3_bucket" "bucket" {
resource "alicloud_oss_bucket" "bucket" {
bucket_prefix = var.BUCKETNAME
region = var.REGION
force_destroy = true
Expand Down
2 changes: 1 addition & 1 deletion components/etcd/backupinfra/provider/s3/tfvars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

ACCESS_KEY: (( config.credentials.accessKeyID ))
SECRET_KEY: (( config.credentials.secretAccessKey ))
SECRET_KEY: (( config.credentials.accessKeySecret ))
LANDSCAPE: (( landscape.name ))
6 changes: 3 additions & 3 deletions components/etcd/backupinfra/provider/s3/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
// limitations under the License.

variable "ACCESS_KEY" {
description = "AWS Access Key"
description = "OSS Access Key"
type = string
}

variable "SECRET_KEY" {
description = "AWS Secret Key"
description = "OSS Secret Key"
type = string
}

variable "REGION" {
description = "Region of the GCS bucket"
description = "Region of the Oss bucket"
type = string
}

Expand Down
1 change: 1 addition & 0 deletions components/etcd/cluster/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
s3: S3
abs: ABS
swift: Swift
oss: OSS

server:
commonName: garden:etcd-server:etcd
Expand Down
23 changes: 23 additions & 0 deletions components/etcd/cluster/provider/oss/provider.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

env:
- name: "ALICLOUD_ENDPOINT"
value: (( config.region ))
- name: "ALICLOUD_ACCESS_KEY_ID"
value: (( config.credentials.accessKeyID ))
- name: "ALICLOUD_ACCESS_KEY_SECRET"
value: (( config.credentials.accessKeySecret ))

volumeMounts: []
Loading

0 comments on commit ad69127

Please sign in to comment.