Skip to content
Open
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/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
-
name: Import GPG key
id: import_gpg
Expand Down
24 changes: 18 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
env:
- PROVIDER_VERSION=0.1-beta
- PROVIDER_VERSION=1.0.1
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
Expand Down Expand Up @@ -33,12 +33,12 @@ builds:
- goos: darwin
goarch: '386'
binary: terraform-provider-delphix
hooks:
post:
hooks:
post:
- cmd: ./dev_copy.sh
env:
env:
- CP_PATH={{ .Path }}
- CP_TARGET={{ .Target }}
- CP_TARGET={{ .Target }}
- CP_VERSION={{ .Env.PROVIDER_VERSION }}
archives:
- format: zip
Expand All @@ -49,11 +49,23 @@ checksum:
name_template: '{{ .ProjectName }}_{{ .Env.PROVIDER_VERSION }}_manifest.json'
name_template: '{{ .ProjectName }}_{{ .Env.PROVIDER_VERSION }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# if you are using this in a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive.
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Env.PROVIDER_VERSION }}_manifest.json'
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true
skip: true
12 changes: 6 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HOSTNAME=delphix.com
NAMESPACE=dct
NAME=delphix
BINARY=terraform-provider-${NAME}
VERSION=0.1-beta
VERSION=1.0.1
OS_ARCH=darwin_amd64

default: install
Expand All @@ -29,9 +29,9 @@ install: build
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}

test:
go test -i $(TEST) || exit 1
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
test:
go test -i $(TEST) || exit 1
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4

testacc:
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
testacc:
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
43 changes: 23 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
# Terraform Provider Delphix

![CodeQL](https://github.com/delphix-integrations/terraform-provider-delphix/actions/workflows/codeql.yml/badge.svg?branch=main)
![Release](https://github.com/delphix-integrations/terraform-provider-delphix/actions/workflows/release.yml/badge.svg?event=release)
![Version](https://img.shields.io/github/v/release/delphix-integrations/terraform-provider-delphix)

Terraform Provider for Delphix enables Terraform to create and manage Delphix Continuous Data &
Continuous Compliance infrastructure using the Delphix Control Tower (DCT) APIs.

Full documentation can he found [here](https://integrations.delphix.com/Terraform/)
Full implementation directions can be found on the [Delphix Ecosystem Documentation](https://ecosystem.delphix.com/docs/overview-3) and [Terraform Provider Registry](https://registry.terraform.io/providers/delphix-integrations/delphix/latest/docs).

## Getting Started (Development)
This guide will eventually cover the following
## Prerequisites

1. Install Delphix Control Tower (DCT). For more information, visit the [DCT documentation](https://docs.delphix.com/dct).
2. Delphix Continuous Data and Continuous Compliance engines must be connected to DCT.
3. An API key must be created for authenticating with DCT APIs. Refer to the [DCT API keys documentation](https://dct.delphix.com/docs/api-keys-2) for more info.
4. Additional infrastructure required for testing the provider operations. [e.g Hosts to be added as environments, dSources to create VDBs from]
5. Development setup for Golang.

1. Setup DCT APi Gateway On Premise by following the [DCT API Gateway setup](https://github.com/delphix/orbital-api-gateway)

2. Install IDE [Visual Studio Code](https://code.visualstudio.com)
## Getting Started (Development)

This guide covers the following

3. Install guide for [golang](https://go.dev/dl/)
1. Install IDE [Visual Studio Code](https://code.visualstudio.com).

4. Install guide for [Goreleaser](https://goreleaser.com/install/)
2. Install guide for [Golang](https://go.dev/dl/).

5. Install Go Plugin for VS Code
3. Install guide for [GoReleaser](https://goreleaser.com/install/).

6. Install [Terraform](https://www.terraform.io/downloads)
4. Install Go Plugin for VS Code.

7. Fork this repo and clone it locally. Switch to develop branch which always heads to the latest development code.
5. Install [Terraform](https://www.terraform.io/downloads).

8. Run following command to create binaries:
6. Fork this repo and clone it locally. Switch to the `develop` branch which always heads to the latest development code.

7. Run following command to create binaries:

```goreleaser release --skip-publish --snapshot --rm-dist```

9. Execute example main.tf file under /examples/<resource> directory using the following commands:
8. Execute example main.tf file under /examples/<resource> directory using the following commands:

```
terraform init
terraform plan
terraform apply
```

## Prerequisites

- Delphix Control Tower (DCT) API Gateway must be installed on-premise.
- Delphix Engines must be registered with DCT-OnPrem.
- API-Keys must be created for authenticating with DCT-OnPrem. Refer to DCT guide for more info.
- Additional infrastructure required for testing the provider operations [ e.g Hosts to be added as environments, dSources to create VDBs from]
- Development setup for GoLang.

## Contributing
This project is currently not accepting external contributions.
24 changes: 15 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# <provider> Terraform-Provider-Delphix
# <provider> Delphix Provider

!> **NOTE**
It is a beta version as of now and it requires Delphix Control Tower 2.0. to work.
The Terraform Provider for Delphix requires the Delphix Continuous Data Platform and Data Control Tower (DCT).

Delphix Terraform provider to interact with different infrastructure resources supported by Delphix. You must configure the provider
with the proper API key generated by DCT and register your Delphix Engine before you can use it.

The Terraform Provider for Delphix enables customers to natively manage data-as-code along with their infrastructure.
With Terraform and Delphix, customers can now automatically provision, manage and teardown any number of ephemeral data environments to drive enterprise DevOps workflows including test data management.

This provider leverages the Delphix APIs available with the Delphix Data Control Tower (DCT). The provider must be configured with the proper API key generated by DCT and registered with associated Delphix engines before use

To learn more about Delphix and DCT APIs, refer to [Delphix Docs](https://docs.delphix.com) and [DCT Docs](https://docs.delphix.com/dct) respectively. Please [Contact us](ask-integrations@delphix.com) (ask-integrations@delphix.com) with any questions.

## Example Usage

```hcl
terraform {
required_providers {
delphix = {
source = "delphix-integrations/delphix"
version = "1.0.0"
source = "delphix.com/local/delphix"
}
}
}

# Configure the DXI Provider
provider "delphix" {
tls_insecure_skip = true
key = "1.XXXX"
host = "HOSTNAME"
tls_insecure_skip = true
key = "dct_api_key"
host = "dct_hostname"
}

# Provision a VDB
Expand All @@ -34,7 +39,8 @@ resource "delphix_vdb" "vdb_name" {

## Configuration and API Key Generation

For generation of the API key, please refer to [Authentication](https://docs.delphix.com/dctmc/authentication).
Delphix Provider uses DCT APIs to communicate with the Delphix engines. Authentication to DCT APIs are handled using API Keys.
For generation of the API key, please refer to [Authentication](https://docs.delphix.com/dct/authentication-170164311.html).


## Argument Reference
Expand Down
80 changes: 62 additions & 18 deletions docs/resources/environment.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Resource: <resource name> delphix_environment

An environment is a a grouping of a single host or a cluster of hosts. environment allows creating hosts or a cluster of hosts.
In Delphix, an environment is either a single instance host or cluster of hosts that run database software.

Environments can either be a source (where data comes from), staging (where data are prepared/masked) or target (where data are delivered and used by developers and testers).

Each environment has its own properties and information depending on the type of environment it is

## Example Usage

### Creating a UNIX standalone environment
### Create UNIX standalone environment

```hcl
resource "delphix_environment" "unix_env_name" {
engine_id = 2
Expand All @@ -31,7 +36,7 @@ resource "delphix_environment" "unix_env_name" {
is_target = false
}
```
### Creating a UNIX cluster
### Create UNIX cluster
```hcl
resource "delphix_environment" "unixcluster" {
engine_id = 2
Expand All @@ -41,11 +46,44 @@ resource "delphix_environment" "unixcluster" {
hostname = "db.host.com"
toolkit_path = "/home/delphix"
name = "unixcluster"
description = "This is a unix target."
description = "This is a unix target."
is_cluster = true
cluster_home = "/u01/app/19.0.0.0/grid"
}
```
### Creating UNIX standalone target environment using HashiCorp Vault
```hcl
resource "delphix_environment" "wintgt" {
engine_id = 2
os_name = "UNIX"
hostname = "xxx"
toolkit_path = "/home/delphix"
name = "unixtgt"

vault = "vault-name"
hashicorp_vault_engine = "xxx"
hashicorp_vault_secret_path = "xxx"
hashicorp_vault_username_key = "xxx"
hashicorp_vault_secret_key = "xxx"

description = "This is unix target."
}
```
### Creating UNIX standalone target environment using CyberArk Vault
```hcl
resource "delphix_environment" "wintgt" {
engine_id = 2
os_name = "UNIX"
hostname = "xxx"
toolkit_path = "/home/delphix"
name = "unixtgt"

vault = "vault-name"
cyberark_query_string = "xxx"

description = "This is unix target."
}
```
### Creating a WINDOWS standalone target environment
```hcl
resource "delphix_environment" "wintgt" {
Expand Down Expand Up @@ -124,45 +162,51 @@ resource "delphix_environment" "fc-tgt-cluster" {

## Argument Reference

* `name` - (Optional) The name of the environment.
* `engine_id` - (Required) The ID of the Engine onto which to create the environment.
* `engine_id` - (Required) The DCT ID of the Engine on which to create the environment. This ID can be obtained by querying the DCT engines API. A Delphix Engine must be registered with DCT first for it to create an Engine ID.
* `os_name` - (Required) Operating system type of the environment. Valid values are `[UNIX, WINDOWS]`
* `hostname` - (Required) Host Name or IP Address of the host that being added to Delphix.
* `name` - (Optional) The name of the environment.
* `is_cluster` - (Optional) Whether the environment to be created is a cluster.
* `cluster_home` - (Optional) Absolute path to cluster home drectory. This parameter is mandatory for UNIX cluster environments.
* `hostname` - (Required) host address of the machine.
* `staging_environment` - (Optional) Id of the connector environment which is used to connect to this source environment. This is mandatory parameter when creating Windows source environments.
* `connector_port` - (Optional) Specify port on which Delphix connector will run. This is mandatory parameter when creating Windows target environments.
* `cluster_home` - (Optional) Absolute path to cluster home drectory. This parameter is (Required) for UNIX cluster environments.
* `staging_environment` - (Optional) Id of the environment where Delphix Connector is installed. This is a (Required) parameter when creating Windows source environments.
* `connector_port` - (Optional) Specify port on which Delphix connector will run. This is a (Required) parameter when creating Windows target environments.
* `is_target` - (Optional) Whether the environment to be created is a target cluster environment. This property is used only when creating Windows cluster environments.
* `ssh_port` - (Optional) ssh port of the host.
* `toolkit_path` - (Optional) The path for the toolkit that resides on the host.
* `username` - (Optional) Username of the OS.
* `password` - (Optional) Password of the OS.
* `ssh_port` - (Optional) ssh port of the environment.
* `toolkit_path` - (Optional) The path where Delphix toolkit can be pushed.
* `username` - (Optional) OS username for Delphix.
* `password` - (Optional) OS user's password.
* `vault` - (Optional) The name or reference of the vault from which to read the host credentials.
* `hashicorp_vault_engine` - (Optional) Vault engine name where the credential is stored.
* `hashicorp_vault_secret_path` - (Optional) Path in the vault engine where the credential is stored.
* `hashicorp_vault_username_key` - (Optional) Key for the username in the key-value store.
* `hashicorp_vault_secret_key` - (Optional) Key for the password in the key-value store.
* `cyberark_vault_query_string` - (Optional) Query to find a credential in the CyberArk vault.
* `nfs_addresses` - (Optional) array of ip address or hostnames. Valid values are a list of addresses. For eg: `["192.168.10.2"]`
* `ase_db_username` - (Optional) username of the SAP ASE database.
* `ase_db_password` - (Optional) password of the SAP ASE database.
* `use_kerberos_authentication` - (Optional) Whether to use kerberos authentication.
* `use_engine_public_key` - (Optional) Whether to use public key authentication.
* `nfs_addresses` - (Optional) Array of ip address or hostnames. Valid values are a list of addresses. For eg: `["192.168.10.2"]`
* `ase_db_username` - (Optional) Username for the SAP ASE database.
* `ase_db_password` - (Optional) Password for the SAP ASE database.
* `ase_db_vault` - (Optional) The name or reference of the vault from which to read the ASE database credentials.
* `ase_db_hashicorp_vault_engine` - (Optional) Vault engine name where the credential is stored.
* `ase_db_hashicorp_vault_secret_path` - (Optional) Path in the vault engine where the credential is stored.
* `ase_db_hashicorp_vault_username_key` - (Optional) Key for the username in the key-value store.
* `ase_db_hashicorp_vault_secret_key` - (Optional) Key for the password in the key-value store.
* `ase_db_cyberark_vault_query_string` - (Optional) Query to find a credential in the CyberArk vault.
* `ase_db_use_kerberos_authentication` - (Optional) Whether to use kerberos authentication for ASE DB discovery.
* `java_home` - (Optional) The path to the user managed Java Development Kit (JDK). If not specified, then the OpenJDK will be used.
* `dsp_keystore_path` - (Optional) DSP keystore path.
* `dsp_keystore_password` - (Optional) DSP keystore password.
* `dsp_keystore_alias` - (Optional) DSP keystore alias.
* `dsp_truststore_path` - (Optional) DSP truststore path.
* `dsp_truststore_password` - (Optional) DSP truststore password.
* `description` - (Optional) The environment description.
* `tags` - (Optional) The tags to be created for this environment. This is a map of 2 parameters:
* `key` - (Required) Key of the tag
* `value` - (Required) Value of the tag

## Attribute Reference

* `namespace` - The namespace of this environment for replicated and restored objects.
* `engine_id` - A reference to the Engine that this Environment connection is associated with.
* `enabled` - True if this environment is enabled.
* `hosts` - The hosts that are part of this environment.
* `hosts` - The hosts that are part of this environment.
Loading