Skip to content

Commit

Permalink
Feat: support private terraform registry (#352)
Browse files Browse the repository at this point in the history
Co-authored-by: qiaozp <[email protected]>
  • Loading branch information
ramekris3163 and chivalryq authored Jan 19, 2023
1 parent 841b0d1 commit c6d69a8
Show file tree
Hide file tree
Showing 8 changed files with 990 additions and 74 deletions.
31 changes: 17 additions & 14 deletions api/types/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@ type ConfigurationState string

// Reasons a resource is or is not ready.
const (
Authorizing ConfigurationState = "Authorizing"
ProviderNotFound ConfigurationState = "ProviderNotFound"
ProviderNotReady ConfigurationState = "ProviderNotReady"
ConfigurationStaticCheckFailed ConfigurationState = "ConfigurationSpecNotValid"
Available ConfigurationState = "Available"
ConfigurationProvisioningAndChecking ConfigurationState = "ProvisioningAndChecking"
ConfigurationDestroying ConfigurationState = "Destroying"
ConfigurationApplyFailed ConfigurationState = "ApplyFailed"
ConfigurationDestroyFailed ConfigurationState = "DestroyFailed"
ConfigurationReloading ConfigurationState = "ConfigurationReloading"
GeneratingOutputs ConfigurationState = "GeneratingTerraformOutputs"
InvalidRegion ConfigurationState = "InvalidRegion"
TerraformInitError ConfigurationState = "TerraformInitError"
InvalidGitCredentialsSecretReference ConfigurationState = "InvalidGitCredentialsSecretReference"
Authorizing ConfigurationState = "Authorizing"
ProviderNotFound ConfigurationState = "ProviderNotFound"
ProviderNotReady ConfigurationState = "ProviderNotReady"
ConfigurationStaticCheckFailed ConfigurationState = "ConfigurationSpecNotValid"
Available ConfigurationState = "Available"
ConfigurationProvisioningAndChecking ConfigurationState = "ProvisioningAndChecking"
ConfigurationDestroying ConfigurationState = "Destroying"
ConfigurationApplyFailed ConfigurationState = "ApplyFailed"
ConfigurationDestroyFailed ConfigurationState = "DestroyFailed"
ConfigurationReloading ConfigurationState = "ConfigurationReloading"
GeneratingOutputs ConfigurationState = "GeneratingTerraformOutputs"
InvalidRegion ConfigurationState = "InvalidRegion"
TerraformInitError ConfigurationState = "TerraformInitError"
InvalidGitCredentialsSecretReference ConfigurationState = "InvalidGitCredentialsSecretReference"
InvalidTerraformCredentialsSecretReference ConfigurationState = "InvalidTerraformCredentialsSecretReference"
InvalidTerraformRCConfigMapReference ConfigurationState = "InvalidTerraformRCConfigMapReference"
InvalidTerraformCredentialsHelperConfigMapReference ConfigurationState = "InvalidTerraformCredentialsHelperConfigMapReference"
)

// Stage is the Terraform stage
Expand Down
9 changes: 9 additions & 0 deletions api/v1beta1/configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ type ConfigurationSpec struct {

// GitCredentialsSecretReference specifies the reference to the secret containing the git credentials
GitCredentialsSecretReference *v1.SecretReference `json:"gitCredentialsSecretReference,omitempty"`

// TerraformCredentialsSecretReference specifies the reference to the secret containing the terraform credentials
TerraformCredentialsSecretReference *v1.SecretReference `json:"terraformCredentialsSecretReference,omitempty"`

// TerraformRCConfigMapReference specifies the reference to a config map containing the terraform registry configuration
TerraformRCConfigMapReference *v1.SecretReference `json:"terraformRCConfigMapReference,omitempty"`

// TerraformCredentialsHelperConfigMapReference specifies the reference to a configmap containing the terraform registry credentials helper
TerraformCredentialsHelperConfigMapReference *v1.SecretReference `json:"terraformCredentialsHelperConfigMapReference,omitempty"`
}

// BaseConfigurationSpec defines the common fields of a ConfigurationSpec
Expand Down
15 changes: 15 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions api/v1beta2/configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ type ConfigurationSpec struct {

// GitCredentialsSecretReference specifies the reference to the secret containing the git credentials
GitCredentialsSecretReference *v1.SecretReference `json:"gitCredentialsSecretReference,omitempty"`

// TerraformCredentialsSecretReference specifies the reference to the secret containing the terraform credentials and terraform registry details
TerraformCredentialsSecretReference *v1.SecretReference `json:"terraformCredentialsSecretReference,omitempty"`

// TerraformRCConfigMapReference specifies the reference to a config map containing the terraform registry configuration
TerraformRCConfigMapReference *v1.SecretReference `json:"terraformRCConfigMapReference,omitempty"`

// TerraformCredentialsHelperConfigMapReference specifies the reference to a configmap containing the terraform registry credentials helper
TerraformCredentialsHelperConfigMapReference *v1.SecretReference `json:"terraformCredentialsHelperConfigMapReference,omitempty"`
}

// ConfigurationStatus defines the observed state of Configuration
Expand Down
15 changes: 15 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions chart/crds/terraform.core.oam.dev_configurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,46 @@ spec:
description: Remote is a git repo which contains hcl files. Currently,
only public git repos are supported.
type: string
terraformCredentialsHelperConfigMapReference:
description: TerraformCredentialsHelperConfigMapReference specifies
the reference to a configmap containing the terraform registry credentials
helper
properties:
name:
description: Name is unique within a namespace to reference a
secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
terraformCredentialsSecretReference:
description: TerraformCredentialsSecretReference specifies the reference
to the secret containing the terraform credentials
properties:
name:
description: Name is unique within a namespace to reference a
secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
terraformRCConfigMapReference:
description: TerraformRCConfigMapReference specifies the reference
to a config map containing the terraform registry configuration
properties:
name:
description: Name is unique within a namespace to reference a
secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
variable:
type: object
x-kubernetes-preserve-unknown-fields: true
Expand Down Expand Up @@ -318,6 +358,47 @@ spec:
description: Remote is a git repo which contains hcl files. Currently,
only public git repos are supported.
type: string
terraformCredentialsHelperConfigMapReference:
description: TerraformCredentialsHelperConfigMapReference specifies
the reference to a configmap containing the terraform registry credentials
helper
properties:
name:
description: Name is unique within a namespace to reference a
secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
terraformCredentialsSecretReference:
description: TerraformCredentialsSecretReference specifies the reference
to the secret containing the terraform credentials and terraform
registry details
properties:
name:
description: Name is unique within a namespace to reference a
secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
terraformRCConfigMapReference:
description: TerraformRCConfigMapReference specifies the reference
to a config map containing the terraform registry configuration
properties:
name:
description: Name is unique within a namespace to reference a
secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
name must be unique.
type: string
type: object
variable:
type: object
x-kubernetes-preserve-unknown-fields: true
Expand Down
Loading

0 comments on commit c6d69a8

Please sign in to comment.