Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDPCP-9880 - GCP Datalake create/delete/read #60

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Go Coverage
uses: gwatts/go-coverage-action@v1.3.0
with:
coverage-threshold: 6.7 # current (2023.08.07) state, should be increased - ideally up to at least 50% - as soon as possible
coverage-threshold: 7.4 # current (2023.10.10) state
cover-pkg: ./...
ignore-pattern: |
/cdp-sdk-go/
Expand Down
154 changes: 154 additions & 0 deletions docs/resources/datalake_gcp_datalake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdp_datalake_gcp_datalake Resource - terraform-provider-cdp"
subcategory: ""
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.
---

# cdp_datalake_gcp_datalake (Resource)

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.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `datalake_name` (String)
- `environment_name` (String)
- `instance_profile` (String)
- `storage_location_base` (String)

### Optional

- `custom_instance_groups` (Attributes Set) (see [below for nested schema](#nestedatt--custom_instance_groups))
- `enable_ranger_raz` (Boolean)
- `image` (Attributes) (see [below for nested schema](#nestedatt--image))
- `java_version` (Number)
- `multi_az` (Boolean)
- `polling_options` (Attributes) Polling related configuration options that could specify various values that will be used during CDP resource creation. (see [below for nested schema](#nestedatt--polling_options))
- `recipes` (Attributes Set) (see [below for nested schema](#nestedatt--recipes))
- `runtime` (String)
- `scale` (String)
- `tags` (Map of String)

### Read-Only

- `certificate_expiration_state` (String)
- `cloudera_manager` (Attributes) (see [below for nested schema](#nestedatt--cloudera_manager))
- `creation_date` (String)
- `crn` (String)
- `endpoints` (Attributes Set) (see [below for nested schema](#nestedatt--endpoints))
- `environment_crn` (String)
- `id` (String) The ID of this resource.
- `instance_groups` (Attributes Set) (see [below for nested schema](#nestedatt--instance_groups))
- `product_versions` (Attributes Set) (see [below for nested schema](#nestedatt--product_versions))
- `status` (String)
- `status_reason` (String)

<a id="nestedatt--custom_instance_groups"></a>
### Nested Schema for `custom_instance_groups`

Required:

- `name` (String)

Optional:

- `instance_type` (String)


<a id="nestedatt--image"></a>
### Nested Schema for `image`

Required:

- `id` (String)

Optional:

- `catalog` (String)


<a id="nestedatt--polling_options"></a>
### Nested Schema for `polling_options`

Optional:

- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion.


<a id="nestedatt--recipes"></a>
### Nested Schema for `recipes`

Required:

- `instance_group_name` (String)
- `recipe_names` (Attributes Set) (see [below for nested schema](#nestedatt--recipes--recipe_names))

<a id="nestedatt--recipes--recipe_names"></a>
### Nested Schema for `recipes.recipe_names`



<a id="nestedatt--cloudera_manager"></a>
### Nested Schema for `cloudera_manager`

Read-Only:

- `cloudera_manager_repository_url` (String)
- `cloudera_manager_server_url` (String)
- `version` (String)


<a id="nestedatt--endpoints"></a>
### Nested Schema for `endpoints`

Read-Only:

- `display_name` (String)
- `knox_service` (String)
- `mode` (String)
- `open` (Boolean)
- `service_name` (String)
- `service_url` (String)


<a id="nestedatt--instance_groups"></a>
### Nested Schema for `instance_groups`

Read-Only:

- `instances` (Attributes Set) (see [below for nested schema](#nestedatt--instance_groups--instances))
- `name` (String)

<a id="nestedatt--instance_groups--instances"></a>
### Nested Schema for `instance_groups.instances`

Read-Only:

- `discovery_fqdn` (String)
- `id` (String)
- `instance_group` (String)
- `instance_status` (String)
- `instance_type_val` (String)
- `private_ip` (String)
- `public_ip` (String)
- `ssh_port` (Number)
- `state` (String)
- `status_reason` (String)



<a id="nestedatt--product_versions"></a>
### Nested Schema for `product_versions`

Read-Only:

- `name` (String)
- `version` (String)


34 changes: 34 additions & 0 deletions examples/resources/cdp_datalake_gcp_datalake/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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.

resource "cdp_datalake_gcp_datalake" "example" {
datalake_name = "<value>"
environment_name = "<value>"
cloud_provider_configuration = {
service_account_email = "<value>"
storage_location = "<value>"
}
}

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

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

output "service_account_email" {
value = cdp_datalake_gcp_datalake.example.cloud_provider_configuration.service_account_email
}

output "storage_location" {
value = cdp_datalake_gcp_datalake.example.cloud_provider_configuration.storage_location
}
1 change: 1 addition & 0 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ func (p *CdpProvider) Resources(_ context.Context) []func() resource.Resource {
environments.NewGcpCredentialResource,
datalake.NewAwsDatalakeResource,
datalake.NewAzureDatalakeResource,
datalake.NewGcpDatalakeResource,
iam.NewGroupResource,
datahub.NewAwsDatahubResource,
datahub.NewAzureDatahubResource,
Expand Down
129 changes: 129 additions & 0 deletions resources/datalake/common_schema.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// 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.

package datalake

import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)

var generalAttributes = map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"polling_options": schema.SingleNestedAttribute{
MarkdownDescription: "Polling related configuration options that could specify various values that will be used during CDP resource creation.",
Optional: true,
Attributes: map[string]schema.Attribute{
"polling_timeout": schema.Int64Attribute{
MarkdownDescription: "Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion.",
Default: int64default.StaticInt64(60),
Computed: true,
Optional: true,
},
},
},
"creation_date": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"crn": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"datalake_name": schema.StringAttribute{
Required: true,
},
"enable_ranger_raz": schema.BoolAttribute{
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
},
"environment_crn": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"environment_name": schema.StringAttribute{
Required: true,
},
"image": schema.SingleNestedAttribute{
Optional: true,
Attributes: map[string]schema.Attribute{
"catalog": schema.StringAttribute{
Optional: true,
},
"id": schema.StringAttribute{
Required: true,
},
},
},
"java_version": schema.Int64Attribute{
Optional: true,
},
"recipes": schema.SetNestedAttribute{
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"instance_group_name": schema.StringAttribute{
Required: true,
},
"recipe_names": schema.SetNestedAttribute{
Required: true,
},
},
},
},
"runtime": schema.StringAttribute{
Optional: true,
},
"scale": schema.StringAttribute{
Computed: true,
Optional: true,
},
"status": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"status_reason": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"multi_az": schema.BoolAttribute{
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
},
"tags": schema.MapAttribute{
Optional: true,
ElementType: types.StringType,
},
}
Loading
Loading