Skip to content

Commit

Permalink
refactor: rename secret resource to env_secret
Browse files Browse the repository at this point in the history
  • Loading branch information
ianaya89 committed Nov 25, 2024
1 parent 80603b3 commit 03c38db
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 36 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.1](https://github.com/Altinity/terraform-provider-altinitycloud/compare/v0.4.0...v0.4.1)

## [0.4.0](https://github.com/Altinity/terraform-provider-altinitycloud/compare/v0.3.1...v0.4.0)
### Added
- Support for HCloud environments [#117](https://github.com/Altinity/terraform-provider-altinitycloud/pull/117).
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/env_hcloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ variable "hcloud_token" {
type = string
}
resource "altinitycloud_secret" "this" {
resource "altinitycloud_env_secret" "this" {
pem = altinitycloud_env_certificate.this.pem
value = var.hcloud_token
}
Expand All @@ -31,7 +31,7 @@ resource "altinitycloud_env_hcloud" "this" {
cidr = "10.136.0.0/21"
network_zone = "us-west"
locations = ["hil"]
hcloud_token_enc = altinitycloud_secret.this.secret_value
hcloud_token_enc = altinitycloud_env_secret.this.secret_value
force_destroy = true
load_balancers = {
Expand Down
40 changes: 40 additions & 0 deletions docs/resources/env_secret.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "altinitycloud_env_secret Resource - terraform-provider-altinitycloud"
subcategory: ""
description: |-
Altinity.Cloud secret resource.
---

# altinitycloud_env_secret (Resource)

Altinity.Cloud secret resource.

## Example Usage

```terraform
resource "altinitycloud_env_certificate" "this" {
env_name = "acme-staging"
}
variable "value" {
type = string
}
resource "altinitycloud_env_secret" "this" {
pem = altinitycloud_env_certificate.this.pem
value = var.value
}
```

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

### Required

- `pem` (String, Sensitive)
- `value` (String)

### Read-Only

- `secret_value` (String, Sensitive)
25 changes: 0 additions & 25 deletions docs/resources/secret.md

This file was deleted.

4 changes: 2 additions & 2 deletions examples/resources/altinitycloud_env_hcloud/public/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "hcloud_token" {
type = string
}

resource "altinitycloud_secret" "this" {
resource "altinitycloud_env_secret" "this" {
pem = altinitycloud_env_certificate.this.pem
value = var.hcloud_token
}
Expand All @@ -16,7 +16,7 @@ resource "altinitycloud_env_hcloud" "this" {
cidr = "10.136.0.0/21"
network_zone = "us-west"
locations = ["hil"]
hcloud_token_enc = altinitycloud_secret.this.secret_value
hcloud_token_enc = altinitycloud_env_secret.this.secret_value
force_destroy = true

load_balancers = {
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/altinitycloud_env_secret/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "value" {
type = string
}

resource "altinitycloud_secret" "this" {
resource "altinitycloud_env_secret" "this" {
pem = altinitycloud_env_certificate.this.pem
value = var.value
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type SecretResource struct {
}

func (r *SecretResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_secret"
resp.TypeName = req.ProviderTypeName + "_env_secret"
}

func (r *SecretResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

const RESOURCE_NAME = "altinitycloud_secret"
const RESOURCE_NAME = "altinitycloud_env_secret"
const FILE_NAME = RESOURCE_NAME + ".dummy"

func TestAccAltinityCloudSecret_Basic(t *testing.T) {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import (
env_hcloud "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env/hcloud"
env_k8s "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env/k8s"
env_certificate "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env_certificate"
env_secret "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env_secret"
env_status_aws "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env_status/aws"
env_status_azure "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env_status/azure"
env_status_gcp "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env_status/gcp"
env_status_hcloud "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env_status/hcloud"
env_status_k8s "github.com/altinity/terraform-provider-altinitycloud/internal/provider/env_status/k8s"
"github.com/altinity/terraform-provider-altinitycloud/internal/provider/secret"
"github.com/altinity/terraform-provider-altinitycloud/internal/sdk/auth"
"github.com/altinity/terraform-provider-altinitycloud/internal/sdk/client"
"github.com/altinity/terraform-provider-altinitycloud/internal/sdk/crypto"
Expand Down Expand Up @@ -173,7 +173,7 @@ func (p *altinityCloudProvider) Resources(ctx context.Context) []func() resource
env_hcloud.NewHCloudEnvResource,
env_k8s.NewK8SEnvResource,
env_certificate.NewCertificateResource,
secret.NewSecretResource,
env_secret.NewSecretResource,
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/sdk/client/graphql.schema
Original file line number Diff line number Diff line change
Expand Up @@ -1437,8 +1437,8 @@ type UpdateAzureEnvResult {
specRevision: Int!
}
extend type Query {
codeGenAWSEnv(name: String!, fullExample: Boolean = false): CodeGenEnvOutput!
codeGenGCPEnv(name: String!, fullExample: Boolean = false): CodeGenEnvOutput!
codeGenAWSEnv(name: String!, boilerplate: Boolean = false): CodeGenEnvOutput!
codeGenGCPEnv(name: String!, boilerplate: Boolean = false): CodeGenEnvOutput!
}

type CodeGenEnvOutput {
Expand Down

0 comments on commit 03c38db

Please sign in to comment.