Skip to content

Commit

Permalink
Docs improvements (#426)
Browse files Browse the repository at this point in the history
* Docs improvements

* Fix broken link
  • Loading branch information
wcmjunior authored Jul 27, 2023
1 parent 4edbfc9 commit c69a876
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cyral/data_source_cyral_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func dataSourceRepositoryReadConfig() ResourceOperationConfig {

func dataSourceRepository() *schema.Resource {
return &schema.Resource{
Description: "Retrieve and filter repositories.",
Description: "Retrieves a list of repositories. See [`repository_list`](#nestedatt--repository_list).",
ReadContext: ReadResource(dataSourceRepositoryReadConfig()),
Schema: map[string]*schema.Schema{
RepoNameKey: {
Expand Down
10 changes: 6 additions & 4 deletions cyral/resource_cyral_repository_access_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,12 @@ func resourceRepositoryAccessRules() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"policy_ids": {
Description: "Extra authorization policies, such as PagerDuty or DUO.",
Required: true,
Type: schema.TypeList,
MinItems: 1,
Description: "Extra authorization policies, such as PagerDuty or DUO." +
" Use the attribute `id` from resources `cyral_integration_pager_duty`" +
" and `cyral_integration_mfa_duo`.",
Required: true,
Type: schema.TypeList,
MinItems: 1,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down
44 changes: 36 additions & 8 deletions docs/data-sources/repository.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cyral_repository (Data Source)

Retrieve and filter repositories.
Retrieves a list of repositories. See [`repository_list`](#nestedatt--repository_list).

## Example Usage

Expand All @@ -18,27 +18,55 @@ resource "cyral_repository" "mongo-repository" {
}
}
resource "cyral_repository" "mysql-repository" {
resource "cyral_repository" "mysql-repository1" {
type = "mysql"
name = "tf-provider-mysql-repository"
name = "tf-provider-mysql-repository1"
repo_node {
host = "mysql.com"
port = 3306
}
}
data "cyral_repository" "search-for-mysql-repo" {
resource "cyral_repository" "mysql-repository2" {
type = "mysql"
name = "tf-provider-mysql-repository2"
repo_node {
host = "mysql2.com"
port = 3306
}
}
data "cyral_repository" "specific-mysql-repo" {
depends_on = [
cyral_repository.mongo-repository,
cyral_repository.mysql-repository
cyral_repository.mysql-repository1,
cyral_repository.mysql-repository2,
]
name = "tf-provider-mysql-repository"
# As we have more than one MySQL repos, we need to provide
# the name and type or just the name (repo names are unique)
name = "tf-provider-mysql-repository1"
type = "mysql"
}
output "mysql_repo_id" {
value = data.cyral_repository.search-for-mysql-repo.id
data "cyral_repository" "all-mysql-repos" {
depends_on = [
cyral_repository.mongo-repository,
cyral_repository.mysql-repository1,
cyral_repository.mysql-repository2,
]
type = "mysql"
}
output "mysql1_repo_id" {
# Because our search is targeting a specific name that we
# know it exists referencing index 0 is safe.
value = data.cyral_repository.specific-mysql-repo.repository_list[0].id
}
output "all_mysql_repo_ids" {
value = data.cyral_repository.all-mysql-repos.repository_list
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/repository_access_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ Required:

Required:

- `policy_ids` (List of String) Extra authorization policies, such as PagerDuty or DUO.
- `policy_ids` (List of String) Extra authorization policies, such as PagerDuty or DUO. Use the attribute `id` from resources `cyral_integration_pager_duty` and `cyral_integration_mfa_duo`.
42 changes: 35 additions & 7 deletions examples/data-sources/cyral_repository/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,53 @@ resource "cyral_repository" "mongo-repository" {
}
}

resource "cyral_repository" "mysql-repository" {
resource "cyral_repository" "mysql-repository1" {
type = "mysql"
name = "tf-provider-mysql-repository"
name = "tf-provider-mysql-repository1"

repo_node {
host = "mysql.com"
port = 3306
}
}

data "cyral_repository" "search-for-mysql-repo" {
resource "cyral_repository" "mysql-repository2" {
type = "mysql"
name = "tf-provider-mysql-repository2"

repo_node {
host = "mysql2.com"
port = 3306
}
}

data "cyral_repository" "specific-mysql-repo" {
depends_on = [
cyral_repository.mongo-repository,
cyral_repository.mysql-repository
cyral_repository.mysql-repository1,
cyral_repository.mysql-repository2,
]
name = "tf-provider-mysql-repository"
# As we have more than one MySQL repos, we need to provide
# the name and type or just the name (repo names are unique)
name = "tf-provider-mysql-repository1"
type = "mysql"
}

output "mysql_repo_id" {
value = data.cyral_repository.search-for-mysql-repo.id
data "cyral_repository" "all-mysql-repos" {
depends_on = [
cyral_repository.mongo-repository,
cyral_repository.mysql-repository1,
cyral_repository.mysql-repository2,
]
type = "mysql"
}

output "mysql1_repo_id" {
# Because our search is targeting a specific name that we
# know it exists referencing index 0 is safe.
value = data.cyral_repository.specific-mysql-repo.repository_list[0].id
}

output "all_mysql_repo_ids" {
value = data.cyral_repository.all-mysql-repos.repository_list
}

0 comments on commit c69a876

Please sign in to comment.