-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: add remaining IonosCloud resources (#1834)
* doc: fix typo in documentation * doc: add template for PRs * fix: fix PR template * fead: add support for Certificate Manager * feat: implement Private CrossConnect * fix: use proper depth for API calls * feat: implement S3 keys * fix: rename a variable and fix a typo in a warning message (#12) * feat: add support for Container Registry (#11) * feat: add support for Data Platform (#13) * feat: add support for IONOSCLOUD shares (#14) * feat: add support for IONOSCLOUD users (#15) * feat: add support for CUBE and VCPU servers (#17) * feat: add support for Container Registry Tokens (#18) * feat: add support for ALB forwarding rules (#19) * feat: Add support for DBaaS Mongo Clusters (#22) * feat: add support for DNS Zones (#20) * feat: add support for DNS Zones * fix: Modify user agent and update documentation with info about mongo clusters * feat: add support for DNS Records (#23) * feat: add support for DBaaS Mongo Users (#24) * feat: add support for DBaaS PgSQL users (#25) * feat: add support for DBaaS PgSQL databases (#26) * feat: add support for Logging Pipelines (#28) * feat: add support for IP failover groups (#27) * refactor: fix linter errors (#29)
- Loading branch information
1 parent
8ae2440
commit 11226f4
Showing
30 changed files
with
1,151 additions
and
45 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
70 changes: 70 additions & 0 deletions
70
providers/ionoscloud/application_load_balancer_forwarding_rule.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,70 @@ | ||
package ionoscloud | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers" | ||
"github.com/GoogleCloudPlatform/terraformer/terraformutils" | ||
) | ||
|
||
type ALBForwardingRuleGenerator struct { | ||
Service | ||
} | ||
|
||
func (g *ALBForwardingRuleGenerator) InitResources() error { | ||
client := g.generateClient() | ||
cloudAPIClient := client.CloudAPIClient | ||
resourceType := "ionoscloud_application_loadbalancer_forwardingrule" | ||
datacenters, err := helpers.GetAllDatacenters(*cloudAPIClient) | ||
if err != nil { | ||
return err | ||
} | ||
for _, datacenter := range datacenters { | ||
applicationLoadBalancerResponse, _, err := cloudAPIClient.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersGet(context.TODO(), *datacenter.Id).Depth(1).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if applicationLoadBalancerResponse.Items == nil { | ||
log.Printf( | ||
"[WARNING] expected a response containing application load balancers but received 'nil' instead, skipping search for datacenter with ID: %v", | ||
*datacenter.Id) | ||
continue | ||
} | ||
applicationLoadBalancers := *applicationLoadBalancerResponse.Items | ||
for _, applicationLoadBalancer := range applicationLoadBalancers { | ||
if applicationLoadBalancer.Properties == nil || applicationLoadBalancer.Properties.Name == nil { | ||
log.Printf( | ||
"[WARNING] 'nil' values in the response for application load balancer with ID %v, datacenter ID: %v, skipping this resource", | ||
*applicationLoadBalancer.Id, | ||
*datacenter.Id, | ||
) | ||
continue | ||
} | ||
albForwardingRulesResponse, _, err := cloudAPIClient.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersForwardingrulesGet(context.TODO(), *datacenter.Id, *applicationLoadBalancer.Id).Depth(1).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if albForwardingRulesResponse.Items == nil { | ||
log.Printf("[WARNING] expected a response containing ALB forwarding rules but received 'nil' instead, skipping search for ALB with ID: %v, datacenter ID: %v", *applicationLoadBalancer.Id, *datacenter.Id) | ||
continue | ||
} | ||
albForwardingRules := *albForwardingRulesResponse.Items | ||
for _, albForwardingRule := range albForwardingRules { | ||
if albForwardingRule.Properties == nil || albForwardingRule.Properties.Name == nil { | ||
log.Printf("[WARNING] 'nil' values in the response for ALB forwarding rule with ID: %v, ALB ID: %v, datacenter ID: %v, skipping this resource", *albForwardingRule.Id, *applicationLoadBalancer.Id, *datacenter.Id) | ||
continue | ||
} | ||
g.Resources = append(g.Resources, terraformutils.NewResource( | ||
*albForwardingRule.Id, | ||
*albForwardingRule.Properties.Name+"-"+*albForwardingRule.Id, | ||
resourceType, | ||
helpers.Ionos, | ||
map[string]string{"application_loadbalancer_id": *applicationLoadBalancer.Id, helpers.DcID: *datacenter.Id}, | ||
[]string{}, | ||
map[string]interface{}{})) | ||
} | ||
} | ||
} | ||
return nil | ||
} |
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,44 @@ | ||
package ionoscloud | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers" | ||
"github.com/GoogleCloudPlatform/terraformer/terraformutils" | ||
) | ||
|
||
type CertificateGenerator struct { | ||
Service | ||
} | ||
|
||
func (g *CertificateGenerator) InitResources() error { | ||
client := g.generateClient() | ||
certManagerAPIClient := client.CertificateManagerAPIClient | ||
resourceType := "ionoscloud_certificate" | ||
|
||
response, _, err := certManagerAPIClient.CertificatesApi.CertificatesGet(context.TODO()).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if response.Items == nil { | ||
log.Printf("[WARNING] expected a response containing certificates but received 'nil' instead.") | ||
return nil | ||
} | ||
certificates := *response.Items | ||
for _, certificate := range certificates { | ||
if certificate.Properties == nil || certificate.Properties.Name == nil { | ||
log.Printf("[WARNING] 'nil' values in the response for the certificate with ID %v, skipping this resource.", *certificate.Id) | ||
continue | ||
} | ||
g.Resources = append(g.Resources, terraformutils.NewResource( | ||
*certificate.Id, | ||
*certificate.Properties.Name+"-"+*certificate.Id, | ||
resourceType, | ||
helpers.Ionos, | ||
map[string]string{}, | ||
[]string{}, | ||
map[string]interface{}{})) | ||
} | ||
return nil | ||
} |
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,44 @@ | ||
package ionoscloud | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers" | ||
"github.com/GoogleCloudPlatform/terraformer/terraformutils" | ||
) | ||
|
||
type ContainerRegistryGenerator struct { | ||
Service | ||
} | ||
|
||
func (g *ContainerRegistryGenerator) InitResources() error { | ||
client := g.generateClient() | ||
containerRegistryAPIClient := client.ContainerRegistryAPIClient | ||
resourceType := "ionoscloud_container_registry" | ||
|
||
response, _, err := containerRegistryAPIClient.RegistriesApi.RegistriesGet(context.TODO()).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if response.Items == nil { | ||
log.Printf("[WARNING] expected a response containing registries but received 'nil' instead.") | ||
return nil | ||
} | ||
registries := *response.Items | ||
for _, registry := range registries { | ||
if registry.Properties == nil || registry.Properties.Name == nil { | ||
log.Printf("[WARNING] 'nil' values in the response for the registry with ID %v, skipping this resource.", *registry.Id) | ||
continue | ||
} | ||
g.Resources = append(g.Resources, terraformutils.NewResource( | ||
*registry.Id, | ||
*registry.Properties.Name+"-"+*registry.Id, | ||
resourceType, | ||
helpers.Ionos, | ||
map[string]string{}, | ||
[]string{}, | ||
map[string]interface{}{})) | ||
} | ||
return nil | ||
} |
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,55 @@ | ||
package ionoscloud | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers" | ||
"github.com/GoogleCloudPlatform/terraformer/terraformutils" | ||
) | ||
|
||
type ContainerRegistryTokenGenerator struct { | ||
Service | ||
} | ||
|
||
func (g *ContainerRegistryTokenGenerator) InitResources() error { | ||
client := g.generateClient() | ||
crClient := client.ContainerRegistryAPIClient | ||
resourceType := "ionoscloud_container_registry_token" | ||
|
||
registriesResponse, _, err := crClient.RegistriesApi.RegistriesGet(context.TODO()).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if registriesResponse.Items == nil { | ||
log.Printf("[WARNING] expected a response containing registries but received 'nil' instead") | ||
return nil | ||
} | ||
registries := *registriesResponse.Items | ||
for _, registry := range registries { | ||
tokensResponse, _, err := crClient.TokensApi.RegistriesTokensGet(context.TODO(), *registry.Id).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if tokensResponse.Items == nil { | ||
log.Printf("[WARNING] expected a response containing container registry tokens, but received 'nil' instead") | ||
return nil | ||
} | ||
crTokens := *tokensResponse.Items | ||
for _, crToken := range crTokens { | ||
if crToken.Properties == nil || crToken.Properties.Name == nil { | ||
log.Printf("[WARNING] 'nil' values in the response for the container registry token with ID: %v, skipping this resource", *crToken.Id) | ||
continue | ||
} | ||
g.Resources = append(g.Resources, terraformutils.NewResource( | ||
*crToken.Id, | ||
*crToken.Properties.Name+"-"+*crToken.Id, | ||
resourceType, | ||
helpers.Ionos, | ||
map[string]string{"registry_id": *registry.Id}, | ||
[]string{}, | ||
map[string]interface{}{})) | ||
} | ||
} | ||
return nil | ||
} |
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,44 @@ | ||
package ionoscloud | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers" | ||
"github.com/GoogleCloudPlatform/terraformer/terraformutils" | ||
) | ||
|
||
type DataPlatformClusterGenerator struct { | ||
Service | ||
} | ||
|
||
func (g *DataPlatformClusterGenerator) InitResources() error { | ||
client := g.generateClient() | ||
dataPlatformClient := client.DataPlatformAPIClient | ||
resourceType := "ionoscloud_dataplatform_cluster" | ||
|
||
response, _, err := dataPlatformClient.DataPlatformClusterApi.ClustersGet(context.TODO()).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if response.Items == nil { | ||
log.Printf("[WARNING] expected a response containing data platform clusters, but received 'nil' instead.") | ||
return nil | ||
} | ||
clusters := *response.Items | ||
for _, cluster := range clusters { | ||
if cluster.Properties == nil || cluster.Properties.Name == nil { | ||
log.Printf("[WARNING] 'nil' values in the response for data platform cluster with ID %v, skipping this resource.", *cluster.Id) | ||
continue | ||
} | ||
g.Resources = append(g.Resources, terraformutils.NewResource( | ||
*cluster.Id, | ||
*cluster.Properties.Name+"-"+*cluster.Id, | ||
resourceType, | ||
helpers.Ionos, | ||
map[string]string{}, | ||
[]string{}, | ||
map[string]interface{}{})) | ||
} | ||
return nil | ||
} |
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,55 @@ | ||
package ionoscloud | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers" | ||
"github.com/GoogleCloudPlatform/terraformer/terraformutils" | ||
) | ||
|
||
type DataPlatformNodePoolGenerator struct { | ||
Service | ||
} | ||
|
||
func (g *DataPlatformNodePoolGenerator) InitResources() error { | ||
client := g.generateClient() | ||
dataPlatformClient := client.DataPlatformAPIClient | ||
resourceType := "ionoscloud_dataplatform_node_pool" | ||
|
||
dpClusters, _, err := dataPlatformClient.DataPlatformClusterApi.ClustersGet(context.TODO()).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if dpClusters.Items == nil { | ||
log.Printf("[WARNING] expected a response containing data platform clusters but received 'nil' instead.") | ||
return nil | ||
} | ||
for _, dpCluster := range *dpClusters.Items { | ||
dpNodePools, _, err := dataPlatformClient.DataPlatformNodePoolApi.ClustersNodepoolsGet(context.TODO(), *dpCluster.Id).Execute() | ||
if err != nil { | ||
return err | ||
} | ||
if dpNodePools.Items == nil { | ||
log.Printf("[WARNING] expected a response containing data platform node pools but received 'nil' instead, skipping search for data platform cluster with ID: %v", *dpCluster.Id) | ||
continue | ||
} | ||
for _, dpNodePool := range *dpNodePools.Items { | ||
if dpNodePool.Properties == nil || dpNodePool.Properties.Name == nil { | ||
log.Printf("[WARNING] 'nil' values in the response for data platform node pool with ID %v, cluster ID: %v, skipping this resource", | ||
*dpNodePool.Id, | ||
*dpCluster.Id) | ||
continue | ||
} | ||
g.Resources = append(g.Resources, terraformutils.NewResource( | ||
*dpNodePool.Id, | ||
*dpNodePool.Properties.Name+"-"+*dpNodePool.Id, | ||
resourceType, | ||
helpers.Ionos, | ||
map[string]string{helpers.ClusterID: *dpCluster.Id}, | ||
[]string{}, | ||
map[string]interface{}{})) | ||
} | ||
} | ||
return nil | ||
} |
Oops, something went wrong.