-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alloydbomni): add service and dependant resources
- Loading branch information
Showing
20 changed files
with
2,878 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
internal/sdkprovider/service/alloydbomni/alloydbomni.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package alloydbomni | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
|
||
"github.com/aiven/terraform-provider-aiven/internal/schemautil" | ||
) | ||
|
||
func aivenAlloyDBOmniSchema() map[string]*schema.Schema { | ||
s := schemautil.ServiceCommonSchemaWithUserConfig(schemautil.ServiceTypeAlloyDBOmni) | ||
s[schemautil.ServiceTypeAlloyDBOmni] = &schema.Schema{ | ||
Type: schema.TypeList, | ||
MaxItems: 1, | ||
Computed: true, | ||
Description: "Values provided by the AlloyDB Omni server.", | ||
Optional: true, | ||
Sensitive: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"uris": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "AlloyDB Omni primary connection URIs.", | ||
Optional: true, | ||
Sensitive: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
Sensitive: true, | ||
}, | ||
}, | ||
"bouncer": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Sensitive: true, | ||
Description: "PgBouncer connection details for [connection pooling](https://aiven.io/docs/products/postgresql/concepts/alloydbomni-connection-pooling).", | ||
Deprecated: "This field was added by mistake and has never worked. It will be removed in future versions.", | ||
}, | ||
"params": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "AlloyDB Omni connection parameters.", | ||
Optional: true, | ||
Sensitive: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"host": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Sensitive: true, | ||
Description: "AlloyDB Omni host IP or name.", | ||
}, | ||
"port": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Sensitive: true, | ||
Description: "AlloyDB Omni port.", | ||
}, | ||
"sslmode": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Sensitive: true, | ||
Description: "AlloyDB Omni SSL mode setting.", | ||
}, | ||
"user": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Sensitive: true, | ||
Description: "AlloyDB Omni admin user name.", | ||
}, | ||
"password": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Sensitive: true, | ||
Description: "AlloyDB Omni admin user password.", | ||
}, | ||
"database_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Sensitive: true, | ||
Description: "Primary AlloyDB Omni database name.", | ||
}, | ||
}, | ||
}, | ||
}, | ||
"replica_uri": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "AlloyDB Omni replica URI for services with a replica.", | ||
Sensitive: true, | ||
}, | ||
"standby_uris": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "AlloyDB Omni standby connection URIs.", | ||
Optional: true, | ||
Sensitive: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
Sensitive: true, | ||
}, | ||
}, | ||
"syncing_uris": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "AlloyDB Omni syncing connection URIs.", | ||
Optional: true, | ||
Sensitive: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
Sensitive: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
return s | ||
} | ||
|
||
func ResourceAlloyDBOmni() *schema.Resource { | ||
return &schema.Resource{ | ||
Description: "Creates and manages an Aiven for AlloyDB Omni service.", | ||
CreateContext: schemautil.ResourceServiceCreateWrapper(schemautil.ServiceTypeAlloyDBOmni), | ||
ReadContext: schemautil.ResourceServiceRead, | ||
UpdateContext: schemautil.ResourceServiceUpdate, | ||
DeleteContext: schemautil.ResourceServiceDelete, | ||
CustomizeDiff: schemautil.CustomizeDiffGenericService(schemautil.ServiceTypeAlloyDBOmni), | ||
Importer: &schema.ResourceImporter{ | ||
StateContext: schema.ImportStatePassthroughContext, | ||
}, | ||
Timeouts: schemautil.DefaultResourceTimeouts(), | ||
Schema: aivenAlloyDBOmniSchema(), | ||
SchemaVersion: 1, | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
internal/sdkprovider/service/alloydbomni/alloydbomni_data_source.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package alloydbomni | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
|
||
"github.com/aiven/terraform-provider-aiven/internal/schemautil" | ||
) | ||
|
||
func DatasourceAlloyDBOmni() *schema.Resource { | ||
return &schema.Resource{ | ||
ReadContext: schemautil.DatasourceServiceRead, | ||
Description: "Gets information about an Aiven for AlloyDB Omni service.", | ||
Schema: schemautil.ResourceSchemaAsDatasourceSchema(aivenAlloyDBOmniSchema(), "project", "service_name"), | ||
} | ||
} |
Oops, something went wrong.