Skip to content

Commit

Permalink
Merge branch 'main' into PL-58649
Browse files Browse the repository at this point in the history
  • Loading branch information
meenakshi-harness committed Jan 14, 2025
2 parents 65f8891 + b3b28e7 commit 7022e83
Show file tree
Hide file tree
Showing 24 changed files with 902 additions and 47 deletions.
4 changes: 4 additions & 0 deletions .changelog/1032.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```relese-note:fix
harness_platform_connector_aws: Added Support for execute_on_delegate param.
harness_platform_connector_azure_cloud_provider: Added Support for execute_on_delegate param.
```
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ test-report.xml
terraform-provider-harness

.terraform.lock.hcl
local.sh
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.34.9 (January 13,2025)

# 0.34.8 (January 08,2025)

# 0.34.7 (January 07,2025)

# 0.34.6 (December 26,2024)

# 0.34.5 (December 09,2024)
Expand Down
37 changes: 37 additions & 0 deletions docs/data-sources/chaos_infrastructure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "harness_chaos_infrastructure Data Source - terraform-provider-harness"
subcategory: "Next Gen"
description: |-
Data source for retrieving a chaos infrastructure.
---

# harness_chaos_infrastructure (Data Source)

Data source for retrieving a chaos infrastructure.

## Example Usage

```terraform
data "harness_chaos_infrastructure" "example" {
identifier = "identifier"
org_id = "org_id"
project_id = "project_id"
environment_id = "env_id"
}
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required

- `environment_id` (String) Environment identifier of the chaos infrastructure.
- `identifier` (String) Identifier of the chaos infrastructure.
- `org_id` (String) Identifier of the organization in which the chaos infrastructure is configured.
- `project_id` (String) Identifier of the project in which the chaos infrastructure is configured.

### Read-Only

- `id` (String) The ID of this resource.
52 changes: 26 additions & 26 deletions docs/data-sources/platform_connector_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,91 +36,91 @@ data "harness_platform_connector_aws" "example" {
- `cross_account_access` (List of Object) Select this option if you want to use one AWS account for the connection, but you want to deploy or build in a different AWS account. In this scenario, the AWS account used for AWS access in Credentials will assume the IAM role you specify in Cross-account role ARN setting. This option uses the AWS Security Token Service (STS) feature. (see [below for nested schema](#nestedatt--cross_account_access))
- `description` (String) Description of the resource.
- `equal_jitter_backoff_strategy` (List of Object) Equal Jitter BackOff Strategy. (see [below for nested schema](#nestedatt--equal_jitter_backoff_strategy))
- `execute_on_delegate` (Boolean) Execute on delegate or not.
- `fixed_delay_backoff_strategy` (List of Object) Fixed Delay BackOff Strategy. (see [below for nested schema](#nestedatt--fixed_delay_backoff_strategy))
- `full_jitter_backoff_strategy` (List of Object) Full Jitter BackOff Strategy. (see [below for nested schema](#nestedatt--full_jitter_backoff_strategy))
- `id` (String) The ID of this resource.
- `inherit_from_delegate` (List of Object) Inherit credentials from the delegate. (see [below for nested schema](#nestedatt--inherit_from_delegate))
- `irsa` (List of Object) Use IAM role for service accounts. (see [below for nested schema](#nestedatt--irsa))
- `manual` (List of Object) Use IAM role for service accounts. (see [below for nested schema](#nestedatt--manual))
- `oidc_authentication` (List of Object) Authentication using harness oidc. (see [below for nested schema](#nestedatt--oidc_authentication))
- `region` AWS Region to perform Connection test of Connector.
- `tags` (Set of String) Tags to associate with the resource.

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

Read-Only:

- `external_id` (String) If the administrator of the account to which the role belongs provided you with an external ID, then enter that value.
- `role_arn` (String) The Amazon Resource Name (ARN) of the role that you want to assume. This is an IAM role in the target AWS account.
- `external_id` (String)
- `role_arn` (String)


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

Read-Only:

- `base_delay` (Number) Base delay.
- `max_backoff_time` (Number) Max BackOff Time.
- `retry_count` (Number) Retry Count.
- `base_delay` (Number)
- `max_backoff_time` (Number)
- `retry_count` (Number)


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

Read-Only:

- `fixed_backoff` (Number) Fixed Backoff.
- `retry_count` (Number) Retry Count.
- `fixed_backoff` (Number)
- `retry_count` (Number)


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

Read-Only:

- `base_delay` (Number) Base delay.
- `max_backoff_time` (Number) Max BackOff Time.
- `retry_count` (Number) Retry Count.
- `base_delay` (Number)
- `max_backoff_time` (Number)
- `retry_count` (Number)


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

Read-Only:

- `delegate_selectors` (Set of String) The delegates to inherit the credentials from.
- `region` AWS Region to perform Connection test of Connector.
- `delegate_selectors` (Set of String)
- `region` (String)


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

Read-Only:

- `delegate_selectors` (Set of String) The delegates to inherit the credentials from.
- `region` AWS Region to perform Connection test of Connector.
- `delegate_selectors` (Set of String)
- `region` (String)


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

Read-Only:

- `access_key` (String) AWS access key.
- `access_key_ref` (String) Reference to the Harness secret containing the aws access key. To reference a secret at the organization scope, prefix 'org' to the expression: org.{identifier}. To reference a secret at the account scope, prefix 'account` to the expression: account.{identifier}.
- `delegate_selectors` (Set of String) Connect only use delegates with these tags.
- `secret_key_ref` (String) Reference to the Harness secret containing the aws secret key. To reference a secret at the organization scope, prefix 'org' to the expression: org.{identifier}. To reference a secret at the account scope, prefix 'account` to the expression: account.{identifier}.
- `session_token_ref` (String) Reference to the Harness secret containing the aws session token.
- `region` AWS Region to perform Connection test of Connector.
- `access_key` (String)
- `access_key_plain_text` (String)
- `access_key_ref` (String)
- `delegate_selectors` (Set of String)
- `region` (String)
- `secret_key_ref` (String)
- `session_token_ref` (String)


<a id="nestedatt--oidc_authentication"></a>
### Nested Schema for `oidc authentication`
### Nested Schema for `oidc_authentication`

Read-Only:

- `iam_role_arn` (String) The IAM Role to assume the credentials from.
- `delegate_selectors` (Set of String) The delegates to inherit the credentials from.
- `region` AWS Region to perform Connection test of Connector.

- `delegate_selectors` (Set of String)
- `iam_role_arn` (String)
- `region` (String)
61 changes: 61 additions & 0 deletions docs/resources/chaos_infrastructure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "harness_chaos_infrastructure Resource - terraform-provider-harness"
subcategory: "Next Gen"
description: |-
Resource for creating a Chaos Infrastructure.
---

# harness_chaos_infrastructure (Resource)

Resource for creating a Chaos Infrastructure.

### References:

- For details on how to onboard with Terraform, please see [Harness Terraform Provider Overview](https://developer.harness.io/docs/platform/automation/terraform/harness-terraform-provider-overview/)

## Example to create Chaos Infrastructure

```terraform
resource "harness_chaos_infrastructure" "example" {
identifier = "identifier"
name = "name"
org_id = "org_id"
project_id = "project_id"
environment_id = "env_id"
namespace = "namespace"
service_account = "service_acc_name"
}
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required

- `org_id` (String) Unique identifier of the organization.
- `project_id` (String) Unique identifier of the project.
- `environment_id` (String) Environment ID of the chaos infrastructure.
- `identifier` (String) Unique identifier of the resource.
- `name` (String) Name of the resource.
- `namespace` (String) Namespace of the chaos infrastructure.
- `service_account` (String) Service Account of the chaos infrastructure.

### Optional

- `description` (String) Description of the resource.
- `tags` (Set of String) Tags to associate with the resource.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
# Import using the Chaos Infra ID.
terraform import harness_chaos_infrastructure.example <chaos_infra_id>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data "harness_chaos_infrastructure" "example" {
identifier = "identifier"
org_id = "org_id"
project_id = "project_id"
environment_id= "env_id"
}
2 changes: 2 additions & 0 deletions examples/resources/harness_chaos_infrastructure/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import using the Harness chaos_infra_id.
terraform import harness_chaos_infrastructure.example <chaos_infra_id>
11 changes: 11 additions & 0 deletions examples/resources/harness_chaos_infrastructure/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# Sample resource for chaos infrastructure
resource "harness_chaos_infrastructure" "example" {
identifier = "identifier"
name = "name"
org_id = "org_id"
project_id = "project_id"
environment_id = "env_id"
namespace = "namespace"
service_account = "service_acc_name"
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/antihax/optional v1.0.0
github.com/aws/aws-sdk-go v1.46.4
github.com/docker/docker v24.0.5+incompatible
github.com/harness/harness-go-sdk v0.4.23
github.com/harness/harness-go-sdk v0.4.24
github.com/harness/harness-openapi-go-client v0.0.21
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/harness/harness-go-sdk v0.4.23 h1:iPh1v1sdZ1So1CdtqRkX+YY2hXTApaJsDt0XZWwa+hs=
github.com/harness/harness-go-sdk v0.4.23/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk=
github.com/harness/harness-go-sdk v0.4.24 h1:pfN0JdnrwzWgt1OB4SinOGTJp1yy4RCiJr1xpPYOGd0=
github.com/harness/harness-go-sdk v0.4.24/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk=
github.com/harness/harness-openapi-go-client v0.0.21 h1:VtJnpQKZvCAlaCmUPbNR69OT3c5WRdhNN5TOgUwtwZ4=
github.com/harness/harness-openapi-go-client v0.0.21/go.mod h1:u0vqYb994BJGotmEwJevF4L3BNAdU9i8ui2d22gmLPA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down
7 changes: 7 additions & 0 deletions helpers/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ func BuildField(d *schema.ResourceData, field string) optional.String {
return optional.EmptyString()
}

func BuildFieldInt32(d *schema.ResourceData, field string) optional.Int32 {
if arr, ok := d.GetOk(field); ok {
return optional.NewInt32(int32(arr.(int)))
}
return optional.EmptyInt32()
}

func BuildFieldForBoolean(d *schema.ResourceData, field string) optional.Bool {
if arr, ok := d.GetOk(field); ok {

Expand Down
46 changes: 46 additions & 0 deletions helpers/schema_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package helpers

import (
"testing"

"github.com/antihax/optional"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/stretchr/testify/assert"
)

func TestBuildFieldForInt32_Int(t *testing.T) {

var value = 14
expected := optional.NewInt32(int32(value))

resource := createTestResourceForBuildField()
data := map[string]interface{}{
"field_int": value,
}

d := schema.TestResourceDataRaw(t, resource.Schema, data)

assert.Equal(t, expected, BuildFieldInt32(d, "field_int"))
}

func TestBuildFieldForInt32_Missing(t *testing.T) {

expected := optional.EmptyInt32()

resource := createTestResourceForBuildField()
data := map[string]interface{}{}

d := schema.TestResourceDataRaw(t, resource.Schema, data)

assert.Equal(t, expected, BuildFieldInt32(d, "field_int"))
}

func createTestResourceForBuildField() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"field_int": {
Type: schema.TypeInt,
},
},
}
}
Loading

0 comments on commit 7022e83

Please sign in to comment.