Skip to content

Commit

Permalink
Added data-source: user, role, project; resource: team (#44)
Browse files Browse the repository at this point in the history
* Added data-source: user, role, project; resource: team

* Adding tags

* tag changes

* adding tags in examples

* few minor chnages
  • Loading branch information
rishi-anand authored Jun 23, 2021
1 parent 6dd356b commit f6a8d80
Show file tree
Hide file tree
Showing 39 changed files with 946 additions and 17 deletions.
30 changes: 30 additions & 0 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
page_title: "spectrocloud_project Data Source - terraform-provider-spectrocloud"
subcategory: ""
description: |-
---

# Data Source `spectrocloud_project`



## Example Usage

```terraform
data "spectrocloud_project" "project1" {
name = "Default"
# (alternatively)
# id = "5fd0ca727c411c71b55a359c"
}
```

## Schema

### Optional

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


30 changes: 30 additions & 0 deletions docs/data-sources/role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
page_title: "spectrocloud_role Data Source - terraform-provider-spectrocloud"
subcategory: ""
description: |-
---

# Data Source `spectrocloud_role`



## Example Usage

```terraform
data "spectrocloud_role" "role1" {
name = "Project Editor"
# (alternatively)
# id = "5fd0ca727c411c71b55a359c"
}
```

## Schema

### Optional

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


30 changes: 30 additions & 0 deletions docs/data-sources/user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
page_title: "spectrocloud_user Data Source - terraform-provider-spectrocloud"
subcategory: ""
description: |-
---

# Data Source `spectrocloud_user`



## Example Usage

```terraform
data "spectrocloud_user" "user1" {
name = "Foo Bar"
# (alternatively)
# id = "5fd0ca727c411c71b55a359c"
}
```

## Schema

### Optional

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


2 changes: 2 additions & 0 deletions docs/resources/cluster_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ data "spectrocloud_backup_storage_location" "bsl" {
resource "spectrocloud_cluster_aws" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id
cloud_config {
Expand Down Expand Up @@ -115,6 +116,7 @@ resource "spectrocloud_cluster_aws" "cluster" {
- **os_patch_schedule** (String)
- **pack** (Block List) (see [below for nested schema](#nestedblock--pack))
- **scan_policy** (Block List, Max: 1) (see [below for nested schema](#nestedblock--scan_policy))
- **tags** (Set of String)
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-only
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/cluster_azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ data "spectrocloud_cluster_profile" "profile" {
resource "spectrocloud_cluster_azure" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_azure.account.id
cloud_config {
Expand Down Expand Up @@ -100,6 +101,7 @@ resource "spectrocloud_cluster_azure" "cluster" {
- **os_patch_schedule** (String)
- **pack** (Block List) (see [below for nested schema](#nestedblock--pack))
- **scan_policy** (Block List, Max: 1) (see [below for nested schema](#nestedblock--scan_policy))
- **tags** (Set of String)
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-only
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/cluster_eks.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ data "spectrocloud_backup_storage_location" "bsl" {
resource "spectrocloud_cluster_eks" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id
cloud_config {
Expand Down Expand Up @@ -116,6 +117,7 @@ resource "spectrocloud_cluster_eks" "cluster" {
- **id** (String) The ID of this resource.
- **pack** (Block List) (see [below for nested schema](#nestedblock--pack))
- **scan_policy** (Block List, Max: 1) (see [below for nested schema](#nestedblock--scan_policy))
- **tags** (Set of String)
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-only
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/cluster_gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ data "spectrocloud_cluster_profile" "profile" {
resource "spectrocloud_cluster_gcp" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_gcp.account.id
cloud_config {
Expand Down Expand Up @@ -97,6 +98,7 @@ resource "spectrocloud_cluster_gcp" "cluster" {
- **os_patch_schedule** (String)
- **pack** (Block List) (see [below for nested schema](#nestedblock--pack))
- **scan_policy** (Block List, Max: 1) (see [below for nested schema](#nestedblock--scan_policy))
- **tags** (Set of String)
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-only
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/cluster_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ data "spectrocloud_pack" "ubuntu" {
resource "spectrocloud_cluster_profile" "profile" {
name = "vsphere-picard-3"
description = "basic cp"
tags = ["dev", "department:devops", "owner:bob"]
cloud = "vsphere"
type = "cluster"
Expand Down Expand Up @@ -132,6 +133,7 @@ resource "spectrocloud_cluster_profile" "profile" {
- **cloud** (String)
- **description** (String)
- **id** (String) The ID of this resource.
- **tags** (Set of String)
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- **type** (String)

Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster_vsphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ description: |-
- **os_patch_schedule** (String)
- **pack** (Block List) (see [below for nested schema](#nestedblock--pack))
- **scan_policy** (Block List, Max: 1) (see [below for nested schema](#nestedblock--scan_policy))
- **tags** (Set of String)
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-only
Expand Down
89 changes: 89 additions & 0 deletions docs/resources/team.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
page_title: "spectrocloud_team Resource - terraform-provider-spectrocloud"
subcategory: ""
description: |-
---

# Resource `spectrocloud_team`



## Example Usage

```terraform
# user
data "spectrocloud_user" "user1" {
name = "Foo Bar"
}
# role
data "spectrocloud_role" "role1" {
name = "Project Editor"
}
data "spectrocloud_role" "role2" {
name = "Cluster Admin"
}
data "spectrocloud_role" "role3" {
name = "Project Admin"
}
# project
data "spectrocloud_project" "project1" {
name = "Default"
}
data "spectrocloud_project" "project2" {
name = "Prod"
}
resource "spectrocloud_team" "t1" {
name = "team1"
users = [data.spectrocloud_user.user1.id]
project_role_mapping {
id = data.spectrocloud_project.project1.id
roles = [data.spectrocloud_role.role1.id, data.spectrocloud_role.role2.id]
}
project_role_mapping {
id = data.spectrocloud_project.project2.id
roles = [data.spectrocloud_role.role3.id]
}
}
```

## Schema

### Required

- **name** (String)
- **users** (Set of String)

### Optional

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

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

Required:

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


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

Optional:

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


6 changes: 6 additions & 0 deletions examples/data-sources/spectrocloud_project/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data "spectrocloud_project" "project1" {
name = "Default"

# (alternatively)
# id = "5fd0ca727c411c71b55a359c"
}
20 changes: 20 additions & 0 deletions examples/data-sources/spectrocloud_project/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
terraform {
required_providers {
spectrocloud = {
version = ">= 0.1"
source = "spectrocloud/spectrocloud"
}
}
}

variable "sc_host" {}
variable "sc_username" {}
variable "sc_password" {}
variable "sc_project_name" {}

provider "spectrocloud" {
host = var.sc_host
username = var.sc_username
password = var.sc_password
project_name = var.sc_project_name
}
6 changes: 6 additions & 0 deletions examples/data-sources/spectrocloud_role/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data "spectrocloud_role" "role1" {
name = "Project Editor"

# (alternatively)
# id = "5fd0ca727c411c71b55a359c"
}
20 changes: 20 additions & 0 deletions examples/data-sources/spectrocloud_role/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
terraform {
required_providers {
spectrocloud = {
version = ">= 0.1"
source = "spectrocloud/spectrocloud"
}
}
}

variable "sc_host" {}
variable "sc_username" {}
variable "sc_password" {}
variable "sc_project_name" {}

provider "spectrocloud" {
host = var.sc_host
username = var.sc_username
password = var.sc_password
project_name = var.sc_project_name
}
6 changes: 6 additions & 0 deletions examples/data-sources/spectrocloud_user/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data "spectrocloud_user" "user1" {
name = "Foo Bar"

# (alternatively)
# id = "5fd0ca727c411c71b55a359c"
}
20 changes: 20 additions & 0 deletions examples/data-sources/spectrocloud_user/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
terraform {
required_providers {
spectrocloud = {
version = ">= 0.1"
source = "spectrocloud/spectrocloud"
}
}
}

variable "sc_host" {}
variable "sc_username" {}
variable "sc_password" {}
variable "sc_project_name" {}

provider "spectrocloud" {
host = var.sc_host
username = var.sc_username
password = var.sc_password
project_name = var.sc_project_name
}
1 change: 1 addition & 0 deletions examples/e2e/aws/resource_clusterprofile.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ data "spectrocloud_pack" "ubuntu" {
resource "spectrocloud_cluster_profile" "profile" {
name = "aws-picard-2"
description = "basic cp"
tags = ["dev", "department:devops", "owner:bob"]
cloud = "aws"
type = "cluster"

Expand Down
1 change: 1 addition & 0 deletions examples/resources/spectrocloud_cluster_aws/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data "spectrocloud_backup_storage_location" "bsl" {

resource "spectrocloud_cluster_aws" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id

cloud_config {
Expand Down
1 change: 1 addition & 0 deletions examples/resources/spectrocloud_cluster_azure/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ data "spectrocloud_cluster_profile" "profile" {

resource "spectrocloud_cluster_azure" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_azure.account.id

cloud_config {
Expand Down
1 change: 1 addition & 0 deletions examples/resources/spectrocloud_cluster_eks/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data "spectrocloud_backup_storage_location" "bsl" {

resource "spectrocloud_cluster_eks" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_aws.account.id

cloud_config {
Expand Down
1 change: 1 addition & 0 deletions examples/resources/spectrocloud_cluster_gcp/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data "spectrocloud_cluster_profile" "profile" {

resource "spectrocloud_cluster_gcp" "cluster" {
name = var.cluster_name
tags = ["dev", "department:devops", "owner:bob"]
cloud_account_id = data.spectrocloud_cloudaccount_gcp.account.id

cloud_config {
Expand Down
Loading

0 comments on commit f6a8d80

Please sign in to comment.