Skip to content

Commit

Permalink
CDPCP-9672 - add a datalake resource example (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregito authored Aug 1, 2023
1 parent 4773b44 commit 7b86254
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 5 deletions.
45 changes: 44 additions & 1 deletion docs/resources/datalake_aws_datalake.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,50 @@ description: |-

A Data Lake is a service which provides a protective ring around the data stored in a cloud object store, including authentication, authorization, and governance support.


## Example Usage

```terraform
// Copyright 2023 Cloudera. All Rights Reserved.
//
// This file is 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.
//
// This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, either express or implied. Refer to the License for the specific
// permissions and limitations governing your use of the file.
terraform {
required_providers {
cdp = {
source = "registry.terraform.io/cloudera/cdp"
}
}
}
resource "cdp_datalake_aws_datalake" "example" {
datalake_name = "<value>"
environment_name = "<value>"
instance_profile = "<value>"
storage_bucket_location = "<value>"
}
output "name" {
value = cdp_datalake_aws_datalake.example.datalake_name
}
output "environment" {
value = cdp_datalake_aws_datalake.example.environment_name
}
output "instance_profile" {
value = cdp_datalake_aws_datalake.example.instance_profile
}
output "storage_bucket_location" {
value = cdp_datalake_aws_datalake.example.storage_bucket_location
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/environments_azure_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ output "crn" {
- `encryption_key_resource_group_name` (String)
- `encryption_key_url` (String)
- `endpoint_access_gateway_scheme` (String) The scheme for the endpoint gateway. PUBLIC creates an external endpoint that can be accessed over the Internet. Defaults to PRIVATE which restricts the traffic to be internal to the VPC.
- `endpoint_access_gateway_subnet_ids` (Set of String)
- `endpoint_access_gateway_subnet_ids` (Set of String) The subnets to use for endpoint access gateway.
- `existing_network_params` (Attributes) (see [below for nested schema](#nestedatt--existing_network_params))
- `freeipa` (Attributes) (see [below for nested schema](#nestedatt--freeipa))
- `new_network_params` (Attributes) (see [below for nested schema](#nestedatt--new_network_params))
Expand Down Expand Up @@ -159,4 +159,4 @@ Optional:

Required:

- `network_cidr` (String)
- `network_cidr` (String)
40 changes: 40 additions & 0 deletions examples/resources/cdp_datalake_aws_datalake/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2023 Cloudera. All Rights Reserved.
//
// This file is 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.
//
// This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, either express or implied. Refer to the License for the specific
// permissions and limitations governing your use of the file.

terraform {
required_providers {
cdp = {
source = "registry.terraform.io/cloudera/cdp"
}
}
}

resource "cdp_datalake_aws_datalake" "example" {
datalake_name = "<value>"
environment_name = "<value>"
instance_profile = "<value>"
storage_bucket_location = "<value>"
}

output "name" {
value = cdp_datalake_aws_datalake.example.datalake_name
}

output "environment" {
value = cdp_datalake_aws_datalake.example.environment_name
}

output "instance_profile" {
value = cdp_datalake_aws_datalake.example.instance_profile
}

output "storage_bucket_location" {
value = cdp_datalake_aws_datalake.example.storage_bucket_location
}
4 changes: 2 additions & 2 deletions resources/datalake/resource_aws_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func NewAwsDatalakeResource() resource.Resource {
return &awsDatalakeResource{}
}

func (r *awsDatalakeResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
func (r *awsDatalakeResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_datalake_aws_datalake"
}

func (r *awsDatalakeResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
func (r *awsDatalakeResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = awsDatalakeResourceSchema
}

Expand Down

0 comments on commit 7b86254

Please sign in to comment.