Skip to content

Commit

Permalink
Aws resources (#9)
Browse files Browse the repository at this point in the history
* Added AWS

* Support for aws cluster
  • Loading branch information
saamalik authored Dec 31, 2020
1 parent 76f9dcd commit 7b7f099
Show file tree
Hide file tree
Showing 20 changed files with 1,100 additions and 8 deletions.
25 changes: 25 additions & 0 deletions docs/data-sources/cloudaccount_aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
page_title: "spectrocloud_cloudaccount_aws Data Source - terraform-provider-spectrocloud"
subcategory: ""
description: |-
---

# Data Source `spectrocloud_cloudaccount_aws`





## Schema

### Optional

- **id** (String) The ID of this resource.
- **name** (String)

### Read-only

- **aws_access_key** (String)


34 changes: 34 additions & 0 deletions docs/resources/cloudaccount_aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
page_title: "spectrocloud_cloudaccount_aws Resource - terraform-provider-spectrocloud"
subcategory: ""
description: |-
---

# Resource `spectrocloud_cloudaccount_aws`



## Example Usage

```terraform
resource "spectrocloud_cloudaccount_aws" "aws-1" {
name = "aws-1"
aws_access_key = var.aws_access_key
aws_secret_key = var.aws_secret_key
}
```

## Schema

### Required

- **aws_access_key** (String)
- **aws_secret_key** (String, Sensitive)
- **name** (String)

### Optional

- **id** (String) The ID of this resource.


142 changes: 142 additions & 0 deletions docs/resources/cluster_aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
page_title: "spectrocloud_cluster_aws Resource - terraform-provider-spectrocloud"
subcategory: ""
description: |-
---

# Resource `spectrocloud_cluster_aws`



## Example Usage

```terraform
data "spectrocloud_cloudaccount_aws" "account" {
# id = <uid>
name = var.cluster_cloud_account_name
}
data "spectrocloud_cluster_profile" "profile" {
# id = <uid>
name = var.cluster_cluster_profile_name
}
resource "spectrocloud_cluster_aws" "cluster" {
name = var.cluster_name
cluster_profile_id = data.spectrocloud_cluster_profile.profile.id
cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id
cloud_config {
ssh_key_name = "default"
region = "us-west-2"
}
# To override or specify values for a cluster:
# pack {
# name = "spectro-byo-manifest"
# tag = "1.0.x"
# values = <<-EOT
# manifests:
# byo-manifest:
# contents: |
# # Add manifests here
# apiVersion: v1
# kind: Namespace
# metadata:
# labels:
# app: wordpress
# app2: wordpress2
# name: wordpress
# EOT
# }
machine_pool {
control_plane = true
control_plane_as_worker = true
name = "master-pool"
count = 1
instance_type = "t3.large"
disk_size_gb = 62
azs = ["us-west-2a"]
}
machine_pool {
name = "worker-basic"
count = 1
instance_type = "t3.large"
azs = ["us-west-2a"]
}
}
```

## Schema

### Required

- **cloud_account_id** (String)
- **cloud_config** (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--cloud_config))
- **cluster_profile_id** (String)
- **machine_pool** (Block Set, Min: 1) (see [below for nested schema](#nestedblock--machine_pool))
- **name** (String)

### Optional

- **id** (String) The ID of this resource.
- **pack** (Block Set) (see [below for nested schema](#nestedblock--pack))
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-only

- **cloud_config_id** (String)

<a id="nestedblock--cloud_config"></a>
### Nested Schema for `cloud_config`

Required:

- **region** (String)
- **ssh_key_name** (String)


<a id="nestedblock--machine_pool"></a>
### Nested Schema for `machine_pool`

Required:

- **azs** (Set of String)
- **count** (Number)
- **instance_type** (String)
- **name** (String)

Optional:

- **control_plane** (Boolean)
- **control_plane_as_worker** (Boolean)
- **disk_size_gb** (Number)
- **update_strategy** (String)


<a id="nestedblock--pack"></a>
### Nested Schema for `pack`

Required:

- **name** (String)
- **tag** (String)
- **values** (String)


<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- **create** (String)
- **delete** (String)
- **update** (String)


2 changes: 1 addition & 1 deletion docs/resources/cluster_gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ resource "spectrocloud_cluster_gcp" "cluster" {
count = 1
instance_type = "e2-standard-2"
disk_size_gb = 62
azs = ["us-west3-a", "us-west3-b", "us-west3-c"]
azs = ["us-west3-a"]
}
machine_pool {
Expand Down
15 changes: 15 additions & 0 deletions examples/resources/spectrocloud_cloudaccount_aws/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_providers {
spectrocloud = {
version = ">= 0.1"
source = "spectrocloud/spectrocloud"
}
}
}

provider "spectrocloud" {
host = var.sc_host
username = var.sc_username
password = var.sc_password
project_name = var.sc_project_name
}
5 changes: 5 additions & 0 deletions examples/resources/spectrocloud_cloudaccount_aws/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "spectrocloud_cloudaccount_aws" "aws-1" {
name = "aws-1"
aws_access_key = var.aws_access_key
aws_secret_key = var.aws_secret_key
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aws_access_key = "<...>"
aws_secret_key = "<...>"
7 changes: 7 additions & 0 deletions examples/resources/spectrocloud_cloudaccount_aws/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "sc_host" {}
variable "sc_username" {}
variable "sc_password" {}
variable "sc_project_name" {}

variable "aws_access_key" {}
variable "aws_secret_key" {}
15 changes: 15 additions & 0 deletions examples/resources/spectrocloud_cluster_aws/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_providers {
spectrocloud = {
version = ">= 0.1"
source = "spectrocloud/spectrocloud"
}
}
}

provider "spectrocloud" {
host = var.sc_host
username = var.sc_username
password = var.sc_password
project_name = var.sc_project_name
}
59 changes: 59 additions & 0 deletions examples/resources/spectrocloud_cluster_aws/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
data "spectrocloud_cloudaccount_aws" "account" {
# id = <uid>
name = var.cluster_cloud_account_name
}

data "spectrocloud_cluster_profile" "profile" {
# id = <uid>
name = var.cluster_cluster_profile_name
}


resource "spectrocloud_cluster_aws" "cluster" {
name = var.cluster_name
cluster_profile_id = data.spectrocloud_cluster_profile.profile.id
cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id

cloud_config {
ssh_key_name = "default"
region = "us-west-2"
}

# To override or specify values for a cluster:

# pack {
# name = "spectro-byo-manifest"
# tag = "1.0.x"
# values = <<-EOT
# manifests:
# byo-manifest:
# contents: |
# # Add manifests here
# apiVersion: v1
# kind: Namespace
# metadata:
# labels:
# app: wordpress
# app2: wordpress2
# name: wordpress
# EOT
# }

machine_pool {
control_plane = true
control_plane_as_worker = true
name = "master-pool"
count = 1
instance_type = "t3.large"
disk_size_gb = 62
azs = ["us-west-2a"]
}

machine_pool {
name = "worker-basic"
count = 1
instance_type = "t3.large"
azs = ["us-west-2a"]
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cluster_cloud_account_name = "aws-1"
cluster_cluster_profile_name = "ProdAWS"

cluster_name = "aws-2"
9 changes: 9 additions & 0 deletions examples/resources/spectrocloud_cluster_aws/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "sc_host" {}
variable "sc_username" {}
variable "sc_password" {}
variable "sc_project_name" {}

variable "cluster_cloud_account_name" {}
variable "cluster_cluster_profile_name" {}

variable "cluster_name" {}
Loading

0 comments on commit 7b7f099

Please sign in to comment.