Skip to content

Commit

Permalink
Added import to all resources
Browse files Browse the repository at this point in the history
  • Loading branch information
micahlmartin committed Sep 14, 2021
1 parent d10d63d commit 96de803
Show file tree
Hide file tree
Showing 69 changed files with 984 additions and 658 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TEST?=$$(go list ./... | grep -v 'vendor')
SWEEP_DIR?=./internal/provider
SWEEP_ARGS?=
SWEEP_RUN?=all
HOSTNAME=hashicorp.com
NAMESPACE=harness-io
NAME=harness
Expand Down Expand Up @@ -28,4 +29,4 @@ test:

sweep:
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
go test $(SWEEP_DIR) -v -sweep=all $(SWEEPARGS) -timeout 60m
go test $(SWEEP_DIR) -v -sweep=all -sweep-run=$(SWEEP_RUN) $(SWEEPARGS) -timeout 60m
14 changes: 14 additions & 0 deletions docs/resources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ description: |-

Resource for creating a Harness application

## Example Usage

```terraform
resource "harness_application" "myapp" {
name = "My Application"
description = "This is my first Harness application"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand All @@ -30,4 +37,11 @@ Resource for creating a Harness application
- **git_sync_enabled** (Boolean) True if git sync is enabled on this application
- **id** (String) Unique identifier of the application

## Import

Import is supported using the following syntax:

```shell
# Import using the Harness application id
terraform import harness_application.myapp Xyz123
```
56 changes: 11 additions & 45 deletions docs/resources/cloudprovider_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "harness_cloudprovider_aws Resource - terraform-provider-harness"
subcategory: ""
description: |-
Resource for creating a physical data center cloud provider
Resource for creating an AWS cloud provider
---

# harness_cloudprovider_aws (Resource)

Resource for creating a physical data center cloud provider
Resource for creating an AWS cloud provider



Expand All @@ -17,42 +17,25 @@ Resource for creating a physical data center cloud provider

### Required

- **credentials** (Block List, Min: 1, Max: 1) Credential configuration for connecting to AWS (see [below for nested schema](#nestedblock--credentials))
- **name** (String) The name of the cloud provider.
- **secret_access_key_secret_name** (String) The name of the Harness secret containing the AWS secret access key.

### Optional

- **access_key_id** (String) The plain text AWS access key id.
- **access_key_id_secret_name** (String) The name of the Harness secret containing the AWS access key id
- **assume_cross_account_role** (Block List, Max: 1) Configuration for assuming a cross account role. (see [below for nested schema](#nestedblock--assume_cross_account_role))
- **delegate_selector** (String) Select the Delegate to use via one of its Selectors.
- **usage_scope** (Block Set) Usage scopes (see [below for nested schema](#nestedblock--usage_scope))
- **use_ec2_iam_credentials** (Boolean) Use the EC2 Instance Profile for Service Accounts.
- **use_irsa** (Boolean) Use the AWS IAM Role for Service Accounts.

### Read-Only

- **id** (String) The id of the cloud provider.

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

Optional:

- **access_keys** (Block List, Max: 1) Configuration for acquiring credentials with an api key and secret (see [below for nested schema](#nestedblock--credentials--access_keys))
- **assume_cross_account_role** (Block List, Max: 1) Configuration for assuming a cross account role. (see [below for nested schema](#nestedblock--credentials--assume_cross_account_role))
- **delegate** (Block List, Max: 1) Configuration for acquiring credentials through the IAM profile associated with the delegate. (see [below for nested schema](#nestedblock--credentials--delegate))
- **iam_role_service_account** (Block List, Max: 1) Configure the use of IAM role for service accounts. (see [below for nested schema](#nestedblock--credentials--iam_role_service_account))

<a id="nestedblock--credentials--access_keys"></a>
### Nested Schema for `credentials.access_keys`

Required:

- **encrypted_secret_access_key_secret_name** (String) The name of the encrypted text secret in Harness containing the AWS secret access key.

Optional:

- **access_key_id** (String) The plain text AWS access key id.
- **encrypted_access_key_name** (String) The name of the encrypted text secret in Harness containing the AWS access key id


<a id="nestedblock--credentials--assume_cross_account_role"></a>
### Nested Schema for `credentials.assume_cross_account_role`
<a id="nestedblock--assume_cross_account_role"></a>
### Nested Schema for `assume_cross_account_role`

Required:

Expand All @@ -63,23 +46,6 @@ Optional:
- **external_id** (String) If the administrator of the account to which the role belongs provided you with an external ID, then enter that value.


<a id="nestedblock--credentials--delegate"></a>
### Nested Schema for `credentials.delegate`

Required:

- **selector** (String) Select the Delegate to use via one of its Selectors.


<a id="nestedblock--credentials--iam_role_service_account"></a>
### Nested Schema for `credentials.iam_role_service_account`

Required:

- **delegate_selector** (String) Select the Delegate to use via one of its Selectors.



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

Expand Down
24 changes: 23 additions & 1 deletion docs/resources/encrypted_text.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,29 @@ description: |-

Resource for creating an encrypted text secret


## Example Usage

```terraform
data "harness_secret_manager" "default" {
default = true
}
resource "harness_encrypted_text" "example" {
name = "example-secret"
value = "someval"
secret_manager_id = data.harness_secret_manager.default.id
usage_scope {
application_filter_type = "ALL"
environment_filter_type = "PRODUCTION_ENVIRONMENTS"
}
usage_scope {
application_filter_type = "ALL"
environment_filter_type = "NON_PRODUCTION_ENVIRONMENTS"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
56 changes: 55 additions & 1 deletion docs/resources/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,54 @@ description: |-

Resource for creating an environment


## Example Usage

```terraform
# Some comments here about how to use this
resource "harness_application" "test" {
name = "%[1]s"
}
resource "harness_service_kubernetes" "test" {
app_id = harness_application.test.id
name = "%[1]s"
helm_version = "V2"
description = "description"
variable {
name = "test"
value = "test_value"
type = "TEXT"
}
variable {
name = "test2"
value = "test_value2"
type = "TEXT"
}
}
resource "harness_environment" "test" {
app_id = harness_application.test.id
name = "%[1]s"
type = "%[2]s"
variable_override {
service_name = harness_service_kubernetes.test.name
name = "test"
value = "override"
type = "TEXT"
}
variable_override {
service_name = harness_service_kubernetes.test.name
name = "test2"
value = "override2"
type = "TEXT"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -39,4 +86,11 @@ Required:
- **type** (String) The type of the service variable. Valid values are `TEXT` and `ENCRYPTED_TEXT`
- **value** (String) The value of the service variable

## Import

Import is supported using the following syntax:

```shell
# Import using the Harness application id and environment id.
terraform import harness_environment.dev <application_id>:<environment_id>
```
16 changes: 0 additions & 16 deletions examples/resources/application_resource/resource.tf

This file was deleted.

22 changes: 0 additions & 22 deletions examples/resources/connector_resource/git_connector.tf

This file was deleted.

1 change: 0 additions & 1 deletion examples/resources/connector_resource/provider.tf

This file was deleted.

2 changes: 2 additions & 0 deletions examples/resources/harness_application/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import using the Harness application id
terraform import harness_application.myapp Xyz123
4 changes: 4 additions & 0 deletions examples/resources/harness_application/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "harness_application" "myapp" {
name = "My Application"
description = "This is my first Harness application"
}
1 change: 1 addition & 0 deletions examples/resources/harness_application/test.auto.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ip_address = "192.168.0.0.1"
19 changes: 19 additions & 0 deletions examples/resources/harness_encrypted_text/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
data "harness_secret_manager" "default" {
default = true
}

resource "harness_encrypted_text" "example" {
name = "example-secret"
value = "someval"
secret_manager_id = data.harness_secret_manager.default.id

usage_scope {
application_filter_type = "ALL"
environment_filter_type = "PRODUCTION_ENVIRONMENTS"
}

usage_scope {
application_filter_type = "ALL"
environment_filter_type = "NON_PRODUCTION_ENVIRONMENTS"
}
}
2 changes: 2 additions & 0 deletions examples/resources/harness_environment/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import using the Harness application id and environment id.
terraform import harness_environment.dev <application_id>/<environment_id>
42 changes: 42 additions & 0 deletions examples/resources/harness_environment/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
resource "harness_application" "test" {
name = "%[1]s"
}

resource "harness_service_kubernetes" "test" {
app_id = harness_application.test.id
name = "%[1]s"
helm_version = "V2"
description = "description"

variable {
name = "test"
value = "test_value"
type = "TEXT"
}

variable {
name = "test2"
value = "test_value2"
type = "TEXT"
}
}

resource "harness_environment" "test" {
app_id = harness_application.test.id
name = "%[1]s"
type = "%[2]s"

variable_override {
service_name = harness_service_kubernetes.test.name
name = "test"
value = "override"
type = "TEXT"
}

variable_override {
service_name = harness_service_kubernetes.test.name
name = "test2"
value = "override2"
type = "TEXT"
}
}
19 changes: 19 additions & 0 deletions examples/resources/harness_git_connector/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
data "harness_secret_manager" "default" {
default = true
}

resource "harness_encrypted_text" "example" {
name = "example-secret"
value = "foo"
secret_manager_id = data.harness_secret_manager.default.id
}

resource "harness_git_connector" "example" {
name = "example"
url = "https://github.com/harness-io/terraform-provider-harness"
branch = "master"
generate_webhook_url = true
password_secret_id = harness_encrypted_text.example.id
url_type = "REPO"
username = "someuser"
}
Loading

0 comments on commit 96de803

Please sign in to comment.