├── .github
├── dependabot.yml
└── workflows
│ ├── linter.yml
│ ├── release.yaml
│ ├── stale.yaml
│ └── test.yml
├── .gitignore
├── .golangci.json
├── AUTHORS
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── assets
└── waze-sre-logo.png
├── build
├── main.go
└── multi-build
│ └── main.go
├── cmd
├── import.go
├── plan.go
├── provider_cmd_alicloud.go
├── provider_cmd_auth0.go
├── provider_cmd_aws.go
├── provider_cmd_azure.go
├── provider_cmd_azuread.go
├── provider_cmd_azuredevops.go
├── provider_cmd_cloudflare.go
├── provider_cmd_commercetools.go
├── provider_cmd_datadog.go
├── provider_cmd_digitalocean.go
├── provider_cmd_equinixmetal.go
├── provider_cmd_fastly.go
├── provider_cmd_github.go
├── provider_cmd_gitlab.go
├── provider_cmd_gmailfilter.go
├── provider_cmd_google.go
├── provider_cmd_grafana.go
├── provider_cmd_heroku.go
├── provider_cmd_honeycombio.go
├── provider_cmd_ibm.go
├── provider_cmd_ionoscloud.go
├── provider_cmd_keycloak.go
├── provider_cmd_kubernetes.go
├── provider_cmd_launchdarkly.go
├── provider_cmd_linode.go
├── provider_cmd_logzio.go
├── provider_cmd_mackerel.go
├── provider_cmd_mikrotik.go
├── provider_cmd_myrasec.go
├── provider_cmd_newrelic.go
├── provider_cmd_ns1.go
├── provider_cmd_octopusdeploy.go
├── provider_cmd_okta.go
├── provider_cmd_opal.go
├── provider_cmd_openstack.go
├── provider_cmd_opsgenie.go
├── provider_cmd_pagerduty.go
├── provider_cmd_panos.go
├── provider_cmd_rabbitmq.go
├── provider_cmd_tencentcloud.go
├── provider_cmd_vault.go
├── provider_cmd_vultr.go
├── provider_cmd_xenorchestra.go
├── provider_cmd_yandex.go
├── root.go
└── version.go
├── docs
├── alicloud.md
├── auth0.md
├── aws.md
├── azure.md
├── azuread.md
├── azuredevops.md
├── cloudflare.md
├── commercetools.md
├── datadog.md
├── digitalocean.md
├── equinixmetal.md
├── fastly.md
├── gcp.md
├── github.md
├── gitlab.md
├── gmailfilter.md
├── grafana.md
├── heroku.md
├── honeycombio.md
├── ibmcloud.md
├── ionoscloud.md
├── keycloak.md
├── kubernetes.md
├── launchdarkly.md
├── linode.md
├── logz.md
├── mackerel.md
├── mikrotik.md
├── myrasec.md
├── ns1.md
├── octopus.md
├── okta.md
├── opal.md
├── openstack.md
├── opsgenie.md
├── pagerduty.md
├── panos.md
├── rabbitmq.md
├── relic.md
├── tencentcloud.md
├── vault.md
├── vultr.md
├── xen.md
└── yandex.md
├── go.mod
├── go.sum
├── main.go
├── providers
├── alicloud
│ ├── alicloud_provider.go
│ ├── alicloud_service.go
│ ├── connectivity
│ │ ├── client.go
│ │ ├── config.go
│ │ ├── endpoint.go
│ │ └── regions.go
│ ├── dns.go
│ ├── ecs.go
│ ├── key_pair.go
│ ├── nat_gateway.go
│ ├── pvtz.go
│ ├── ram.go
│ ├── rds.go
│ ├── sg.go
│ ├── slb.go
│ ├── vpc.go
│ └── vswitch.go
├── auth0
│ ├── action.go
│ ├── auth0_provider.go
│ ├── auth0_service.go
│ ├── branding.go
│ ├── client.go
│ ├── client_grant.go
│ ├── custom_domain.go
│ ├── email.go
│ ├── hook.go
│ ├── log_stream.go
│ ├── prompt.go
│ ├── resource_server.go
│ ├── role.go
│ ├── rule.go
│ ├── rule_config.go
│ ├── tenant.go
│ ├── trigger_binding.go
│ └── user.go
├── aws
│ ├── accessanalyzer.go
│ ├── acm.go
│ ├── alb.go
│ ├── api_gateway.go
│ ├── api_gatewayv2.go
│ ├── appsync.go
│ ├── autoscaling.go
│ ├── aws_facade.go
│ ├── aws_provider.go
│ ├── aws_service.go
│ ├── batch.go
│ ├── budgets.go
│ ├── cloud9.go
│ ├── cloud_front.go
│ ├── cloudformation.go
│ ├── cloudhsm.go
│ ├── cloudtrail.go
│ ├── cloudwatch.go
│ ├── codebuild.go
│ ├── codecommit.go
│ ├── codedeploy.go
│ ├── codepipeline.go
│ ├── cognito.go
│ ├── config.go
│ ├── customer_gateway.go
│ ├── datapipeline.go
│ ├── devicefarm.go
│ ├── docdb.go
│ ├── dx.go
│ ├── dynamodb.go
│ ├── ebs.go
│ ├── ec2.go
│ ├── ecr.go
│ ├── ecrpublic.go
│ ├── ecs.go
│ ├── efs.go
│ ├── eip.go
│ ├── eks.go
│ ├── elastic_beanstalk.go
│ ├── elasticache.go
│ ├── elb.go
│ ├── emr.go
│ ├── eni.go
│ ├── es.go
│ ├── firehose.go
│ ├── glue.go
│ ├── iam.go
│ ├── identitystore.go
│ ├── igw.go
│ ├── iot.go
│ ├── kinesis.go
│ ├── kms.go
│ ├── lambda.go
│ ├── logs.go
│ ├── media_package.go
│ ├── media_store.go
│ ├── medialive.go
│ ├── mq.go
│ ├── msk.go
│ ├── nacl.go
│ ├── nat_gateway.go
│ ├── opsworks.go
│ ├── organization.go
│ ├── qldb.go
│ ├── rds.go
│ ├── redshift.go
│ ├── resourcegroups.go
│ ├── route53.go
│ ├── route_table.go
│ ├── s3.go
│ ├── secretsmanager.go
│ ├── securityhub.go
│ ├── servicecatalog.go
│ ├── ses.go
│ ├── sfn.go
│ ├── sg.go
│ ├── sg_test.go
│ ├── sns.go
│ ├── sqs.go
│ ├── ssm.go
│ ├── subnet.go
│ ├── swf.go
│ ├── transit_gateway.go
│ ├── vgw.go
│ ├── vpc.go
│ ├── vpc_endpoint.go
│ ├── vpc_peering.go
│ ├── vpn_connection.go
│ ├── waf.go
│ ├── waf_regional.go
│ ├── wafv2.go
│ ├── workspaces.go
│ └── xray.go
├── azure
│ ├── analysis.go
│ ├── app_service.go
│ ├── application_gateway.go
│ ├── azure_provider.go
│ ├── azure_service.go
│ ├── container.go
│ ├── cosmosdb.go
│ ├── data_factory.go
│ ├── database.go
│ ├── databricks.go
│ ├── disk.go
│ ├── dns.go
│ ├── eventhub.go
│ ├── helper.go
│ ├── keyvault.go
│ ├── load_balancer.go
│ ├── management_lock.go
│ ├── network_interface.go
│ ├── network_security_group.go
│ ├── network_watcher.go
│ ├── private_dns.go
│ ├── private_endpoint.go
│ ├── public_ip.go
│ ├── purview.go
│ ├── redis.go
│ ├── resource_group.go
│ ├── route_table.go
│ ├── scaleset.go
│ ├── security_center_contact.go
│ ├── security_center_subscription_pricing.go
│ ├── ssh_public_key.go
│ ├── storage_account.go
│ ├── storage_blob.go
│ ├── storage_container.go
│ ├── subnet.go
│ ├── synapse.go
│ ├── virtual_machine.go
│ └── virtual_network.go
├── azuread
│ ├── app_role_assignment.go
│ ├── application.go
│ ├── azuread_provider.go
│ ├── azuread_service.go
│ ├── group.go
│ ├── service_principal.go
│ └── user.go
├── azuredevops
│ ├── azuredevops_provider.go
│ ├── azuredevops_service.go
│ ├── git_repository.go
│ ├── group.go
│ ├── helpers.go
│ └── project.go
├── cloudflare
│ ├── access.go
│ ├── account_member.go
│ ├── cloudflare_provider.go
│ ├── cloudflare_service.go
│ ├── dns.go
│ ├── firewall.go
│ └── page_rule.go
├── commercetools
│ ├── api_extension.go
│ ├── channel.go
│ ├── commercetools_provider.go
│ ├── commercetools_service.go
│ ├── connectivity
│ │ ├── client.go
│ │ └── config.go
│ ├── custom_object.go
│ ├── helpers.go
│ ├── product_type.go
│ ├── shipping_method.go
│ ├── shipping_zone.go
│ ├── state.go
│ ├── store.go
│ ├── subscription.go
│ ├── tax_category.go
│ └── types.go
├── datadog
│ ├── dashboard.go
│ ├── dashboard_json.go
│ ├── dashboard_list.go
│ ├── datadog_provider.go
│ ├── datadog_service.go
│ ├── downtime.go
│ ├── integration_aws.go
│ ├── integration_aws_lambda_arn.go
│ ├── integration_aws_log_collection.go
│ ├── integration_azure.go
│ ├── integration_gcp.go
│ ├── integration_pagerduty.go
│ ├── integration_pagerduty_service_object.go
│ ├── integration_slack_channel.go
│ ├── logs_archive.go
│ ├── logs_archive_order.go
│ ├── logs_custom_pipeline.go
│ ├── logs_index.go
│ ├── logs_index_order.go
│ ├── logs_integration_pipeline.go
│ ├── logs_metric.go
│ ├── logs_pipeline_order.go
│ ├── metric_metadata.go
│ ├── monitor.go
│ ├── role.go
│ ├── security_monitoring_default_rule.go
│ ├── security_monitoring_rule.go
│ ├── service_level_objective.go
│ ├── synthetics_global_variable.go
│ ├── synthetics_private_location.go
│ ├── synthetics_test_.go
│ └── user.go
├── digitalocean
│ ├── cdn.go
│ ├── certificate.go
│ ├── database_cluster.go
│ ├── digitalocean_provider.go
│ ├── digitalocean_service.go
│ ├── domain.go
│ ├── droplet.go
│ ├── droplet_snapshot.go
│ ├── firewall.go
│ ├── floating_ip.go
│ ├── kubernetes_cluster.go
│ ├── loadbalancer.go
│ ├── project.go
│ ├── ssh_key.go
│ ├── tag.go
│ ├── token_source.go
│ ├── volume.go
│ ├── volume_snapshot.go
│ └── vpc.go
├── equinixmetal
│ ├── device.go
│ ├── equinixmetal_provider.go
│ ├── equinixmetal_service.go
│ ├── spot_market_request.go
│ ├── ssh_key.go
│ └── volume.go
├── fastly
│ ├── fastly_provider.go
│ ├── fastly_service.go
│ ├── service_v1.go
│ ├── tls_subscription.go
│ └── user.go
├── gcp
│ ├── addresses_gen.go
│ ├── autoscalers_gen.go
│ ├── backendBuckets_gen.go
│ ├── backendServices_gen.go
│ ├── bigquery.go
│ ├── cloudFunctions.go
│ ├── cloudbuild.go
│ ├── clouddns.go
│ ├── cloudsql.go
│ ├── cloudtasks.go
│ ├── compute.go
│ ├── dataproc.go
│ ├── disks_gen.go
│ ├── externalVpnGateways_gen.go
│ ├── firewall_gen.go
│ ├── forwardingRules_gen.go
│ ├── gcp_compute_code_generator
│ │ ├── backendServices.go
│ │ ├── basicGcpResource.go
│ │ ├── globalForwardingRules.go
│ │ ├── instanceGroupManagers.go
│ │ ├── main.go
│ │ └── resources.go
│ ├── gcp_facade.go
│ ├── gcp_provider.go
│ ├── gcp_service.go
│ ├── gcs.go
│ ├── gke.go
│ ├── globalAddresses_gen.go
│ ├── globalForwardingRules_gen.go
│ ├── healthChecks_gen.go
│ ├── httpHealthChecks_gen.go
│ ├── httpsHealthChecks_gen.go
│ ├── iam.go
│ ├── images_gen.go
│ ├── instanceGroupManagers_gen.go
│ ├── instanceGroups_gen.go
│ ├── instanceTemplates_gen.go
│ ├── instances.go
│ ├── interconnectAttachments_gen.go
│ ├── kms.go
│ ├── logging.go
│ ├── memoryStore.go
│ ├── monitoring.go
│ ├── networkEndpointGroups_gen.go
│ ├── networks_gen.go
│ ├── nodeGroups_gen.go
│ ├── nodeTemplates_gen.go
│ ├── packetMirrorings_gen.go
│ ├── project.go
│ ├── pubsub.go
│ ├── regionAutoscalers_gen.go
│ ├── regionBackendServices_gen.go
│ ├── regionDisks_gen.go
│ ├── regionHealthChecks_gen.go
│ ├── regionInstanceGroupManagers_gen.go
│ ├── regionInstanceGroups_gen.go
│ ├── regionSslCertificates_gen.go
│ ├── regionTargetHttpProxies_gen.go
│ ├── regionTargetHttpsProxies_gen.go
│ ├── regionUrlMaps_gen.go
│ ├── reservations_gen.go
│ ├── resourcePolicies_gen.go
│ ├── routers_gen.go
│ ├── routes_gen.go
│ ├── schedulerJobs.go
│ ├── securityPolicies_gen.go
│ ├── sslCertificates_gen.go
│ ├── sslPolicies_gen.go
│ ├── subnetworks_gen.go
│ ├── targetHttpProxies_gen.go
│ ├── targetHttpsProxies_gen.go
│ ├── targetInstances_gen.go
│ ├── targetPools_gen.go
│ ├── targetSslProxies_gen.go
│ ├── targetTcpProxies_gen.go
│ ├── targetVpnGateways_gen.go
│ ├── urlMaps_gen.go
│ └── vpnTunnels_gen.go
├── github
│ ├── github_organization.go
│ ├── github_provider.go
│ ├── github_service.go
│ ├── members.go
│ ├── organizationWebhooks.go
│ ├── organization_block.go
│ ├── organization_project.go
│ ├── repositories.go
│ ├── teams.go
│ └── user_ssh_keys.go
├── gitlab
│ ├── gitlab_provider.go
│ ├── gitlab_service.go
│ ├── group.go
│ └── project.go
├── gmailfilter
│ ├── filter.go
│ ├── gmailfilter_provider.go
│ ├── gmailfilter_service.go
│ └── label.go
├── grafana
│ ├── dashboard.go
│ ├── folder.go
│ ├── grafana_provider.go
│ └── grafana_service.go
├── heroku
│ ├── account_feature.go
│ ├── app.go
│ ├── heroku_provider.go
│ ├── heroku_service.go
│ ├── pipeline.go
│ ├── pipeline_coupling.go
│ ├── team_collaborator.go
│ └── team_member.go
├── honeycombio
│ ├── board.go
│ ├── burn_alert.go
│ ├── column.go
│ ├── dataset.go
│ ├── derived_column.go
│ ├── honeycomb_provider.go
│ ├── honeycomb_service.go
│ ├── query.go
│ ├── query_annotation.go
│ ├── slo.go
│ └── trigger.go
├── ibm
│ ├── cis.go
│ ├── cloud_functions.go
│ ├── cloud_log_analysis.go
│ ├── cloud_log_atracker.go
│ ├── cloud_monitoring.go
│ ├── cloud_watson_machine_learning.go
│ ├── cloud_watson_studio.go
│ ├── container_cluster.go
│ ├── continuous_delivery.go
│ ├── cos.go
│ ├── database_elasticsearch.go
│ ├── database_etcd.go
│ ├── database_mongo.go
│ ├── database_postgresql.go
│ ├── database_rabbitmq.go
│ ├── database_redis.go
│ ├── helpers.go
│ ├── iam.go
│ ├── ibm_cd_toolchain.go
│ ├── ibm_certificate_manager.go
│ ├── ibm_cloudant.go
│ ├── ibm_code_engine.go
│ ├── ibm_dl.go
│ ├── ibm_is_floating_ip.go
│ ├── ibm_is_flow_log.go
│ ├── ibm_is_ike_policy.go
│ ├── ibm_is_image.go
│ ├── ibm_is_instance.go
│ ├── ibm_is_instance_template.go
│ ├── ibm_is_ipsec_policy.go
│ ├── ibm_is_lb.go
│ ├── ibm_is_network_acl.go
│ ├── ibm_is_public_gateway.go
│ ├── ibm_is_security_group.go
│ ├── ibm_is_ssh_key.go
│ ├── ibm_is_subnet.go
│ ├── ibm_is_virtual_endpoint_gateway.go
│ ├── ibm_is_volume.go
│ ├── ibm_is_vpc.go
│ ├── ibm_is_vpc_address_prefix.go
│ ├── ibm_is_vpc_route.go
│ ├── ibm_is_vpc_routing_table.go
│ ├── ibm_is_vpn_gateway.go
│ ├── ibm_kp.go
│ ├── ibm_private_dns.go
│ ├── ibm_provider.go
│ ├── ibm_secret_manager.go
│ ├── ibm_service.go
│ ├── ibm_tg.go
│ ├── instance_groups.go
│ ├── satellite_control_plane.go
│ ├── satellite_data_plane.go
│ ├── utils.go
│ └── vpc_cluster.go
├── ionoscloud
│ ├── application_load_balancer.go
│ ├── application_load_balancer_forwarding_rule.go
│ ├── backup_unit.go
│ ├── certificate.go
│ ├── container_registry.go
│ ├── container_registry_token.go
│ ├── datacenter.go
│ ├── dataplatform_cluster.go
│ ├── dataplatform_node_pool.go
│ ├── dbaas_mongo_cluster.go
│ ├── dbaas_mongo_user.go
│ ├── dbaas_pgsql_cluster.go
│ ├── dbaas_pgsql_database.go
│ ├── dbaas_pgsql_user.go
│ ├── dns_record.go
│ ├── dns_zone.go
│ ├── firewall.go
│ ├── group.go
│ ├── helpers
│ │ ├── constants.go
│ │ └── helper_dependencies_list.go
│ ├── ionoscloud_provider.go
│ ├── ionoscloud_service.go
│ ├── ip_block.go
│ ├── ipfailover.go
│ ├── kubernetes_cluster.go
│ ├── kubernetes_node_pool.go
│ ├── lan.go
│ ├── load_balancer.go
│ ├── logging_pipeline.go
│ ├── nat_gateway.go
│ ├── nat_gateway_rule.go
│ ├── network_load_balancer.go
│ ├── network_load_balancer_forwarding_rule.go
│ ├── nic.go
│ ├── private_crossconnect.go
│ ├── s3_key.go
│ ├── server.go
│ ├── share.go
│ ├── target_group.go
│ ├── user.go
│ └── volume.go
├── keycloak
│ ├── authentication.go
│ ├── generator.go
│ ├── group.go
│ ├── helpers.go
│ ├── keycloak_provider.go
│ ├── keycloak_service.go
│ ├── openid_client.go
│ ├── realm.go
│ ├── role.go
│ ├── scope.go
│ └── user.go
├── kubernetes
│ ├── kind.go
│ ├── kubernetes_provider.go
│ ├── kubernetes_service.go
│ └── utils.go
├── launchdarkly
│ ├── feature_flags.go
│ ├── launchdarkly_provider.go
│ ├── launchdarkly_service.go
│ ├── project.go
│ └── segment.go
├── linode
│ ├── domain.go
│ ├── image.go
│ ├── instance.go
│ ├── linode_provider.go
│ ├── linode_service.go
│ ├── nodebalancer.go
│ ├── rdns.go
│ ├── sshkey.go
│ ├── stackscript.go
│ ├── token.go
│ └── volume.go
├── logzio
│ ├── alert_notification_endpoints.go
│ ├── alerts.go
│ ├── logzio_provider.go
│ └── logzio_service.go
├── mackerel
│ ├── alert_group_setting.go
│ ├── aws_integration.go
│ ├── channel.go
│ ├── downtime.go
│ ├── mackerel_provider.go
│ ├── mackerel_service.go
│ ├── monitor.go
│ ├── notification_group.go
│ ├── role.go
│ └── service.go
├── mikrotik
│ ├── dhcp_leases.go
│ ├── mikrotik_provider.go
│ └── mikrotik_service.go
├── myrasec
│ ├── cache_setting.go
│ ├── dns_record.go
│ ├── domain.go
│ ├── error_page.go
│ ├── ip_filter.go
│ ├── maintenance.go
│ ├── myrasec_provider.go
│ ├── myrasec_service.go
│ ├── ratelimit.go
│ ├── redirect.go
│ ├── settings.go
│ └── waf_rule.go
├── newrelic
│ ├── alert.go
│ ├── alertchannel.go
│ ├── alertcondition.go
│ ├── alertpolicy.go
│ ├── helpers.go
│ ├── infra.go
│ ├── newrelic_provider.go
│ ├── newrelic_service.go
│ ├── synthetics.go
│ └── tags.go
├── ns1
│ ├── monitoringjob.go
│ ├── ns1_provider.go
│ ├── ns1_service.go
│ ├── team.go
│ └── zone.go
├── octopusdeploy
│ ├── generic_resources.go
│ ├── octopusdeploy_provider.go
│ └── octopusdeploy_service.go
├── okta
│ ├── app.go
│ ├── app_auto_login.go
│ ├── app_basic_auth.go
│ ├── app_bookmark.go
│ ├── app_oauth.go
│ ├── app_saml.go
│ ├── app_secure_password_store.go
│ ├── app_signon_policy.go
│ ├── app_signon_policy_rule.go
│ ├── app_swa.go
│ ├── app_three_field.go
│ ├── app_user_schema.go
│ ├── authenticator.go
│ ├── authorization_server.go
│ ├── authorization_server_claim.go
│ ├── authorization_server_policy.go
│ ├── authorization_server_policy_rule.go
│ ├── authorization_server_scope.go
│ ├── event_hook.go
│ ├── factor.go
│ ├── group.go
│ ├── group_rule.go
│ ├── helpers.go
│ ├── idp_oidc.go
│ ├── idp_saml.go
│ ├── idp_social.go
│ ├── inline_hook.go
│ ├── network_zone.go
│ ├── okta_provider.go
│ ├── okta_service.go
│ ├── policy_mfa.go
│ ├── policy_password.go
│ ├── policy_rule_mfa.go
│ ├── policy_rule_password.go
│ ├── policy_rule_signon.go
│ ├── policy_signon.go
│ ├── template_sms.go
│ ├── trusted_origin.go
│ ├── user.go
│ ├── user_schema.go
│ └── user_type.go
├── opal
│ ├── group.go
│ ├── helpers.go
│ ├── message_channel.go
│ ├── on_call_schedule.go
│ ├── opal_provider.go
│ ├── opal_service.go
│ ├── owner.go
│ └── resource.go
├── openstack
│ ├── blockstorage.go
│ ├── compute.go
│ ├── networking.go
│ ├── openstack_provider.go
│ └── openstack_service.go
├── opsgenie
│ ├── opsgenie_provider.go
│ ├── opsgenie_service.go
│ ├── service.go
│ ├── team.go
│ └── user.go
├── pagerduty
│ ├── business_service.go
│ ├── escalation_policy.go
│ ├── pagerduty_provider.go
│ ├── pagerduty_service.go
│ ├── ruleset.go
│ ├── schedule.go
│ ├── service.go
│ ├── team.go
│ └── user.go
├── panos
│ ├── firewall_device_config.go
│ ├── firewall_networking.go
│ ├── firewall_objects.go
│ ├── firewall_policy.go
│ ├── helpers.go
│ ├── panorama_device_config.go
│ ├── panorama_networking.go
│ ├── panorama_objects.go
│ ├── panorama_plugins.go
│ ├── panorama_policy.go
│ ├── panos_provider.go
│ └── panos_service.go
├── rabbitmq
│ ├── binding.go
│ ├── exchange.go
│ ├── helpers.go
│ ├── permissions.go
│ ├── policy.go
│ ├── queue.go
│ ├── rabbitmq_provider.go
│ ├── rabbitmq_service.go
│ ├── shovel.go
│ ├── user.go
│ └── vhost.go
├── tencentcloud
│ ├── acl.go
│ ├── as.go
│ ├── cbs.go
│ ├── cdn.go
│ ├── cfs.go
│ ├── clb.go
│ ├── cos.go
│ ├── cvm.go
│ ├── dnspod.go
│ ├── eip.go
│ ├── elasticsearch.go
│ ├── gaap.go
│ ├── key_pair.go
│ ├── mongodb.go
│ ├── mysql.go
│ ├── nat_gateway.go
│ ├── pts.go
│ ├── redis.go
│ ├── route_table.go
│ ├── scf.go
│ ├── security_group.go
│ ├── ses.go
│ ├── ssl.go
│ ├── subnet.go
│ ├── tat.go
│ ├── tcaplus.go
│ ├── tencentcloud_helpers.go
│ ├── tencentcloud_provider.go
│ ├── tencentcloud_service.go
│ ├── vpc.go
│ └── vpn.go
├── vault
│ ├── vault_provider.go
│ └── vault_service_generator.go
├── vultr
│ ├── bare_metal_server.go
│ ├── block_storage.go
│ ├── dns_domain.go
│ ├── firewall_group.go
│ ├── network.go
│ ├── reserved_ip.go
│ ├── server.go
│ ├── snapshot.go
│ ├── ssh_key.go
│ ├── startup_script.go
│ ├── user.go
│ ├── vultr_provider.go
│ └── vultr_service.go
├── xenorchestra
│ ├── acls.go
│ ├── resource_sets.go
│ ├── xenorchestra_provider.go
│ └── xenorchestra_service.go
└── yandex
│ ├── compute_disk.go
│ ├── compute_instance.go
│ ├── util.go
│ ├── vpc_network.go
│ ├── vpc_subnet.go
│ ├── yandex_provider.go
│ └── yandex_service.go
├── snap
└── snapcraft.yaml
├── terraformutils
├── base_provider.go
├── connect.go
├── connect_test.go
├── flatmap.go
├── flatmap_test.go
├── hcl.go
├── hcl_test.go
├── json.go
├── providers_mapping.go
├── providerwrapper
│ ├── provider.go
│ └── provider_test.go
├── resource.go
├── service.go
├── service_test.go
├── terraformerstring
│ └── string.go
├── terraformoutput
│ ├── bucket.go
│ └── hcl.go
├── test_data
│ ├── test1.json
│ ├── test2.json
│ ├── test3.json
│ ├── test4.json
│ ├── test5.json
│ ├── test6.json
│ ├── test7.json
│ ├── test8.json
│ └── test9.json
├── tfstate_converter_test.go
├── utils.go
├── walk.go
└── walk_test.go
└── tests
├── aws
└── main.go
├── commercetools
└── main.go
├── datadog
├── README.md
├── helper.go
├── main.go
└── resources
│ ├── dashboard.tf
│ ├── downtime.tf
│ ├── monitor.tf
│ ├── outputs.tf
│ ├── synthetics.tf
│ └── user.tf
├── gcp
└── main.go
├── github
└── main.go
├── octopusdeploy
├── README.md
├── channel.tf
├── environment.tf
├── feed.tf
├── library_variable_set.tf
├── lifecycle.tf
├── main.tf
├── project.tf
├── project_group.tf
├── provider.tf
└── tagset.tf
├── openstack
└── main.go
└── rabbitmq
└── main.go
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "gomod"
9 | directory: "/"
10 | schedule:
11 | interval: "weekly"
12 |
13 | # Maintain dependencies for GitHub Actions
14 | - package-ecosystem: "github-actions"
15 | directory: "/"
16 | schedule:
17 | interval: "weekly"
18 |
--------------------------------------------------------------------------------
/.github/workflows/linter.yml:
--------------------------------------------------------------------------------
1 | name: linter
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | pull_request:
8 | branches:
9 | - master
10 |
11 | jobs:
12 | linter:
13 | name: golangci-lint
14 | runs-on: ubuntu-latest
15 | steps:
16 | - name: Check out code into the Go module directory
17 | uses: actions/checkout@v4
18 | - name: golangci-lint
19 | uses: reviewdog/action-golangci-lint@v2
20 | with:
21 | go_version_file: go.mod
22 | github_token: ${{ secrets.GITHUB_TOKEN }}
23 | tool_name: golangci-lint
24 |
--------------------------------------------------------------------------------
/.github/workflows/release.yaml:
--------------------------------------------------------------------------------
1 | name: "tagged-release"
2 | on:
3 | workflow_dispatch:
4 | inputs:
5 | version:
6 | description: Bump Version
7 | required: true
8 | jobs:
9 | tagged-release:
10 | name: "Tagged Release"
11 | runs-on: "ubuntu-latest"
12 |
13 | steps:
14 | - uses: actions/checkout@v4
15 | - name: Install Go
16 | uses: actions/setup-go@v5
17 | with:
18 | go-version-file: go.mod
19 | cache: true
20 | - name: Test
21 | run: go build -v && go test ./...
22 | - name: Build for linux/amd64
23 | run: go build -o terraformer-all-linux-amd64
24 | - name: Build for linux/arm64
25 | run: GOOS=linux GOARCH=arm64 go build -o terraformer-all-linux-arm64
26 | - name: Build for mac
27 | run: GOOS=darwin go build -o terraformer-all-darwin-amd64
28 | - name: Build for mac Apple Silicon
29 | run: GOOS=darwin GOARCH=arm64 go build -o terraformer-all-darwin-arm64
30 | - name: Build for all providers
31 | run: go run build/multi-build/main.go
32 |
33 | - uses: "marvinpinto/action-automatic-releases@latest"
34 | with:
35 | repo_token: "${{ secrets.GITHUB_TOKEN }}"
36 | automatic_release_tag: ${{ github.event.inputs.version }}
37 | prerelease: false
38 | files: |
39 | terraformer-*
40 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yaml:
--------------------------------------------------------------------------------
1 | name: 'Close stale issues and PRs'
2 | on:
3 | schedule:
4 | - cron: '30 1 * * *'
5 |
6 | jobs:
7 | stale:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/stale@v9
11 | with:
12 | repo-token: ${{ secrets.GITHUB_TOKEN }}
13 | stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
14 | close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
15 | days-before-issue-stale: 60
16 | days-before-issue-close: 7
17 | days-before-pr-close: -1
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: tests
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | pull_request:
8 | branches:
9 | - master
10 |
11 | jobs:
12 | test:
13 | strategy:
14 | matrix:
15 | platform: [ubuntu-latest, macos-latest]
16 | runs-on: ${{ matrix.platform }}
17 | steps:
18 | - uses: actions/checkout@v4
19 | - name: Install Go
20 | uses: actions/setup-go@v5
21 | with:
22 | go-version-file: go.mod
23 | cache: true
24 | - name: Go Mod Tidy
25 | run: go mod tidy
26 | - name: Test
27 | run: go build -v && go test ./...
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | generated
3 | terraformer*
4 | cmd/tmp
5 | .DS_Store
6 | .terraform
7 | .vscode
8 | terraform.tfstate
9 | terraform.tfstate.backup
10 | init.tf
11 | vendor/
--------------------------------------------------------------------------------
/.golangci.json:
--------------------------------------------------------------------------------
1 | {
2 | "formatters": {
3 | "enable": [
4 | "gofmt",
5 | "goimports"
6 | ],
7 | "exclusions": {
8 | "generated": "lax",
9 | "paths": [
10 | "third_party$",
11 | "builtin$",
12 | "examples$"
13 | ]
14 | }
15 | },
16 | "issues": {
17 | "max-issues-per-linter": 0,
18 | "max-same-issues": 0
19 | },
20 | "linters": {
21 | "enable": [
22 | "gocritic",
23 | "revive",
24 | "unconvert",
25 | "unparam"
26 | ],
27 | "exclusions": {
28 | "generated": "lax",
29 | "paths": [
30 | "third_party$",
31 | "builtin$",
32 | "examples$"
33 | ],
34 | "presets": [
35 | "comments",
36 | "common-false-positives",
37 | "legacy",
38 | "std-error-handling"
39 | ]
40 | }
41 | },
42 | "run": {
43 | "concurrency": 8,
44 | "issues-exit-code": 1,
45 | "modules-download-mode": "readonly"
46 | },
47 | "version": "2"
48 | }
49 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | # This is the list of Terraformer authors for copyright purposes.
2 | #
3 | # This does not necessarily list everyone who has contributed code, since in
4 | # some cases, their employer may be the copyright holder. To see the full list
5 | # of contributors, see the revision history in source control.
6 | Sergey Lanzman
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | We'd love to accept your patches and contributions to this project. There are
4 | just a few small guidelines you need to follow.
5 |
6 | ## Contributor License Agreement
7 |
8 | Contributions to this project must be accompanied by a Contributor License
9 | Agreement. You (or your employer) retain the copyright to your contribution;
10 | this simply gives us permission to use and redistribute your contributions as
11 | part of the project. Head over to to see
12 | your current agreements on file or to sign a new one.
13 |
14 | You generally only need to submit a CLA once, so if you've already submitted one
15 | (even if it was for a different project), you probably don't need to do it
16 | again.
17 |
18 | ## Code reviews
19 |
20 | All submissions, including submissions by project members, require review. We
21 | use GitHub pull requests for this purpose. Consult
22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23 | information on using pull requests.
24 |
25 | ## Community Guidelines
26 |
27 | This project follows
28 | [Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | To report a security issue, please use http://g.co/vulnz. We use
2 | http://g.co/vulnz for our intake, and do coordination and disclosure here on
3 | GitHub (including using GitHub Security Advisory). The Google Security Team will
4 | respond within 5 working days of your report on g.co/vulnz.
5 |
--------------------------------------------------------------------------------
/assets/waze-sre-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GoogleCloudPlatform/terraformer/5fd6ae9765c8d6d2a3eece26acc68b29742696c3/assets/waze-sre-logo.png
--------------------------------------------------------------------------------
/cmd/provider_cmd_myrasec.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | myrasec_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/myrasec"
5 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
6 | "github.com/spf13/cobra"
7 | )
8 |
9 | //
10 | // newCmdMyrasecImporter
11 | //
12 | func newCmdMyrasecImporter(options ImportOptions) *cobra.Command {
13 | cmd := &cobra.Command{
14 | Use: "myrasec",
15 | Short: "Import current state to Terraform configuration from Myra Security",
16 | Long: "Import current state to Terraform configuration from Myra Security",
17 | RunE: func(cmd *cobra.Command, args []string) error {
18 | provider := newMyrasecProvider()
19 | err := Import(provider, options, []string{})
20 | if err != nil {
21 | return err
22 | }
23 | return nil
24 | },
25 | }
26 |
27 | cmd.AddCommand(listCmd(newMyrasecProvider()))
28 | baseProviderFlags(cmd.PersistentFlags(), &options, "domain", "")
29 | return cmd
30 | }
31 |
32 | //
33 | // newMyrasecProvider
34 | //
35 | func newMyrasecProvider() terraformutils.ProviderGenerator {
36 | return &myrasec_terraforming.MyrasecProvider{}
37 | }
38 |
--------------------------------------------------------------------------------
/cmd/provider_cmd_octopusdeploy.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | octopusdeploy_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/octopusdeploy"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
7 | "github.com/spf13/cobra"
8 | )
9 |
10 | func newCmdOctopusDeployImporter(options ImportOptions) *cobra.Command {
11 | var server, apiKey string
12 | cmd := &cobra.Command{
13 | Use: "octopusdeploy",
14 | Short: "Import current state to Terraform configuration from Octopus Deploy",
15 | Long: "Import current state to Terraform configuration from Octopus Deploy",
16 | RunE: func(cmd *cobra.Command, args []string) error {
17 | provider := newOctopusDeployProvider()
18 | options.PathPattern = "{output}/{provider}/"
19 | err := Import(provider, options, []string{server, apiKey})
20 | if err != nil {
21 | return err
22 | }
23 | return nil
24 | },
25 | }
26 |
27 | cmd.AddCommand(listCmd(newOctopusDeployProvider()))
28 | baseProviderFlags(cmd.PersistentFlags(), &options, "octopusdeploy", "tagset")
29 | cmd.PersistentFlags().StringVar(&server, "server", "", "Octopus Server's API endpoint or env param OCTOPUS_CLI_SERVER")
30 | cmd.PersistentFlags().StringVar(&apiKey, "apikey", "", "Octopus API key or env param OCTOPUS_CLI_API_KEY")
31 | return cmd
32 | }
33 |
34 | func newOctopusDeployProvider() terraformutils.ProviderGenerator {
35 | return &octopusdeploy_terraforming.OctopusDeployProvider{}
36 | }
37 |
--------------------------------------------------------------------------------
/cmd/provider_cmd_opsgenie.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "github.com/spf13/cobra"
5 |
6 | opsgenie_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/opsgenie"
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | func newCmdOpsgenieImporter(options ImportOptions) *cobra.Command {
11 | var apiKey string
12 | cmd := &cobra.Command{
13 | Use: "opsgenie",
14 | Short: "Import current state to Terraform configuration from Opsgenie",
15 | Long: "Import current state to Terraform configuration from Opsgenie",
16 | RunE: func(cmd *cobra.Command, args []string) error {
17 | provider := newOpsgenieProvider()
18 | err := Import(provider, options, []string{apiKey})
19 | if err != nil {
20 | return err
21 | }
22 | return nil
23 | },
24 | }
25 | cmd.AddCommand(listCmd(newOpsgenieProvider()))
26 | baseProviderFlags(cmd.PersistentFlags(), &options, "user,team", "")
27 | cmd.PersistentFlags().StringVarP(&apiKey, "api-key", "", "", "YOUR_OPSGENIE_API_KEY or env param OPSGENIE_API_KEY")
28 | return cmd
29 | }
30 |
31 | func newOpsgenieProvider() terraformutils.ProviderGenerator {
32 | return &opsgenie_terraforming.OpsgenieProvider{}
33 | }
34 |
--------------------------------------------------------------------------------
/cmd/version.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/spf13/cobra"
7 | )
8 |
9 | const version = "v0.8.30"
10 |
11 | var versionCmd = &cobra.Command{
12 | Use: "version",
13 | Short: "Print the version number of Terraformer",
14 | Run: func(cmd *cobra.Command, args []string) {
15 | fmt.Println("Terraformer " + version)
16 | },
17 | }
18 |
--------------------------------------------------------------------------------
/docs/alicloud.md:
--------------------------------------------------------------------------------
1 |
2 | ### Use with AliCloud
3 |
4 | You can either edit your alicloud config directly, (usually it is `~/.aliyun/config.json`)
5 | or run `aliyun configure` and enter the credentials when prompted.
6 |
7 | Example:
8 |
9 | ```json
10 | {
11 | "current": "default",
12 | "profiles": [
13 | {
14 | "name": "default",
15 | "mode": "AK",
16 | "access_key_id": "LTA***",
17 | "access_key_secret": "mrZ***",
18 | "region_id": "cn-hangzhou",
19 | "output_format": "json",
20 | "language": "en"
21 | }
22 | ],
23 | "meta_path": ""
24 | }
25 | ```
26 |
27 | Terraformer will pick up the profile name specified in the `--profile` parameter.
28 | It defaults to the first config in the config array.
29 |
30 | ```sh
31 | terraformer import alicloud --resources=ecs --regions=ap-southeast-3 --profile=default
32 | ```
33 |
34 | List of supported AliCloud resources:
35 |
36 | * `dns`
37 | * `alicloud_dns`
38 | * `alicloud_dns_record`
39 | * `ecs`
40 | * `alicloud_instance`
41 | * `keypair`
42 | * `alicloud_key_pair`
43 | * `nat`
44 | * `alicloud_nat_gateway`
45 | * `pvtz`
46 | * `alicloud_pvtz_zone`
47 | * `alicloud_pvtz_zone_attachment`
48 | * `alicloud_pvtz_zone_record`
49 | * `ram`
50 | * `alicloud_ram_role`
51 | * `alicloud_ram_role_policy_attachment`
52 | * `rds`
53 | * `alicloud_db_instance`
54 | * `sg`
55 | * `alicloud_security_group`
56 | * `alicloud_security_group_rule`
57 | * `slb`
58 | * `alicloud_slb`
59 | * `alicloud_slb_server_group`
60 | * `alicloud_slb_listener`
61 | * `vpc`
62 | * `alicloud_vpc`
63 | * `vswitch`
64 | * `alicloud_vswitch`
65 |
--------------------------------------------------------------------------------
/docs/auth0.md:
--------------------------------------------------------------------------------
1 | ### Use with Auth0
2 |
3 | Example:
4 |
5 | ```
6 | $ export AUTH0_DOMAIN=
7 | $ export AUTH0_CLIENT_ID=
8 | $ export AUTH0_CLIENT_SECRET=
9 | $ terraformer import auth0 --resources=auth0_rule,auth0_user
10 | ```
11 |
12 | List of supported Auth0 services:
13 |
14 | * `auth0_action`
15 | * `auth0_branding`
16 | * `auth0_client`
17 | * `auth0_client_grant`
18 | * `auth0_custom_domain`
19 | * `auth0_email`
20 | * `auth0_hook`
21 | * `auth0_log_stream`
22 | * `auth0_prompt`
23 | * `auth0_resource_server`
24 | * `auth0_role`
25 | * `auth0_rule`
26 | * `auth0_rule_config`
27 | * `auth0_tenant`
28 | * `auth0_trigger_binding`
29 | * `auth0_user`
30 |
--------------------------------------------------------------------------------
/docs/azuread.md:
--------------------------------------------------------------------------------
1 | ### Use with Azure Active Directory
2 |
3 | Example:
4 |
5 | ```
6 | $ export ARM_TENANT_ID=
7 | $ export ARM_CLIENT_ID=
8 | $ export ARM_CLIENT_SECRET=
9 | $ terraformer import azuread --resources=user,application
10 | ```
11 |
12 | List of supported AzureAD services:
13 |
14 | * `app_role_assignment`
15 | * `azuread_app_role_assignment`
16 | * `application`
17 | * `azuread_application`
18 | * `group`
19 | * `azuread_group`
20 | * `service_principal`
21 | * `azuread_service_principal`
22 | * `user`
23 | * `azuread_user`
24 |
--------------------------------------------------------------------------------
/docs/azuredevops.md:
--------------------------------------------------------------------------------
1 | # Use with Azure DevOps
2 |
3 | Supports access via [Personal Access Token](https://registry.terraform.io/providers/microsoft/azuredevops/latest/docs/guides/authenticating_using_the_personal_access_token).
4 |
5 | ## Example
6 |
7 | ``` sh
8 | export AZDO_ORG_SERVICE_URL="https://dev.azure.com/"
9 | export AZDO_PERSONAL_ACCESS_TOKEN=""
10 |
11 | ./terraformer import azuredevops -r *
12 | ./terraformer import azuredevops -r project,git_repository
13 | ```
14 |
15 | ## List of supported Azure DevOps resources
16 |
17 | * `git_repository`
18 | * `azuredevops_git_repository`
19 | * `group`
20 | * `azuredevops_group`
21 | * `project`
22 | * `azuredevops_project`
23 |
24 | ## Notes
25 |
26 | Since [Terraform Provider for Azure DevOps](https://github.com/microsoft/terraform-provider-azuredevops) `version 0.17`.
27 |
--------------------------------------------------------------------------------
/docs/cloudflare.md:
--------------------------------------------------------------------------------
1 | ### Use with Cloudflare
2 |
3 | Example using a Cloudflare API Key and corresponding email:
4 | ```
5 | export CLOUDFLARE_API_KEY=[CLOUDFLARE_API_KEY]
6 | export CLOUDFLARE_EMAIL=[CLOUDFLARE_EMAIL]
7 | export CLOUDFLARE_ACCOUNT_ID=[CLOUDFLARE_ACCOUNT_ID]
8 | ./terraformer import cloudflare --resources=firewall,dns
9 | ```
10 |
11 | or using a Cloudflare API Token:
12 |
13 | ```
14 | export CLOUDFLARE_API_TOKEN=[CLOUDFLARE_API_TOKEN]
15 | export CLOUDFLARE_ACCOUNT_ID=[CLOUDFLARE_ACCOUNT_ID]
16 | ./terraformer import cloudflare --resources=firewall,dns
17 | ```
18 |
19 | List of supported Cloudflare services:
20 |
21 | * `access`
22 | * `cloudflare_access_application`
23 | * `account_member`
24 | * `cloudflare_account_member`
25 | * `dns`
26 | * `cloudflare_record`
27 | * `cloudflare_zone`
28 | * `firewall`
29 | * `cloudflare_access_rule`
30 | * `cloudflare_filter`
31 | * `cloudflare_firewall_rule`
32 | * `cloudflare_rate_limit`
33 | * `cloudflare_zone_lockdown`
34 | * `page_rule`
35 | * `cloudflare_page_rule`
36 |
--------------------------------------------------------------------------------
/docs/commercetools.md:
--------------------------------------------------------------------------------
1 | ### Use with [Commercetools](https://commercetools.com/de/)
2 |
3 | This provider use the [terraform-provider-commercetools](https://github.com/labd/terraform-provider-commercetools). The terraformer provider was build by [Dustin Deus](https://github.com/StarpTech).
4 |
5 | Example:
6 |
7 | Export required variables:
8 |
9 | ```bash
10 | export CTP_PROJECT_KEY=key
11 | export CTP_CLIENT_ID=foo
12 | export CTP_CLIENT_SECRET=bar
13 | export CTP_CLIENT_SCOPE=scope
14 | ```
15 |
16 | Export optional variables in case default values are not appropriate:
17 |
18 | ```bash
19 | export CTP_BASE_URL=base_url # default: https://api.sphere.io
20 | export CTP_TOKEN_URL=token_url # default: https://auth.sphere.io
21 | ```
22 |
23 | Run terraformer
24 |
25 | ```bash
26 | ./terraformer plan commercetools -r=types # Only planning
27 | ./terraformer import commercetools -r=types # Import commercetools types
28 | ```
29 |
30 | List of supported [commercetools](https://commercetools.com/de/) resources:
31 |
32 | - `api_extension`
33 | - `commercetools_api_extension`
34 | - `channel`
35 | - `commercetools_channel`
36 | - `custom_object`
37 | - `commercetools_custom_object`
38 | - `product_type`
39 | - `commercetools_product_type`
40 | - `shipping_method`
41 | - `commercetools_shipping_method`
42 | - `shipping_zone`
43 | - `commercetools_shipping_zone`
44 | - `state`
45 | - `commercetools_state`
46 | - `store`
47 | - `commercetools_store`
48 | - `subscription`
49 | - `commercetools_subscription`
50 | - `tax_category`
51 | - `commercetools_tax_category`
52 | - `types`
53 | - `commercetools_type`
54 |
--------------------------------------------------------------------------------
/docs/digitalocean.md:
--------------------------------------------------------------------------------
1 | ### Use with DigitalOcean
2 |
3 | Example:
4 |
5 | ```
6 | export DIGITALOCEAN_TOKEN=[DIGITALOCEAN_TOKEN]
7 | ./terraformer import digitalocean -r project,droplet
8 | ```
9 |
10 | List of supported DigitalOcean resources:
11 |
12 | * `cdn`
13 | * `digitalocean_cdn`
14 | * `certificate`
15 | * `digitalocean_certificate`
16 | * `database_cluster`
17 | * `digitalocean_database_cluster`
18 | * `digitalocean_database_connection_pool`
19 | * `digitalocean_database_db`
20 | * `digitalocean_database_replica`
21 | * `digitalocean_database_user`
22 | * `domain`
23 | * `digitalocean_domain`
24 | * `digitalocean_record`
25 | * `droplet`
26 | * `digitalocean_droplet`
27 | * `droplet_snapshot`
28 | * `digitalocean_droplet_snapshot`
29 | * `firewall`
30 | * `digitalocean_firewall`
31 | * `floating_ip`
32 | * `digitalocean_floating_ip`
33 | * `kubernetes_cluster`
34 | * `digitalocean_kubernetes_cluster`
35 | * `digitalocean_kubernetes_node_pool`
36 | * `loadbalancer`
37 | * `digitalocean_loadbalancer`
38 | * `project`
39 | * `digitalocean_project`
40 | * `ssh_key`
41 | * `digitalocean_ssh_key`
42 | * `tag`
43 | * `digitalocean_tag`
44 | * `volume`
45 | * `digitalocean_volume`
46 | * `volume_snapshot`
47 | * `digitalocean_volume_snapshot`
48 | * `vpc`
49 | * `digitalocean_vpc`
50 |
--------------------------------------------------------------------------------
/docs/equinixmetal.md:
--------------------------------------------------------------------------------
1 | ### Use with Equinix Metal
2 |
3 | Example:
4 |
5 | ```
6 | export METAL_AUTH_TOKEN=[METAL_AUTH_TOKEN]
7 | export PACKET_PROJECT_ID=[PROJECT_ID]
8 | ./terraformer import metal -r volume,device
9 | ```
10 |
11 | List of supported Equinix Metal resources:
12 |
13 | * `device`
14 | * `metal_device`
15 | * `spotmarketrequest`
16 | * `metal_spot_market_request`
17 | * `sshkey`
18 | * `metal_ssh_key`
19 | * `volume`
20 | * `metal_volume`
21 |
--------------------------------------------------------------------------------
/docs/fastly.md:
--------------------------------------------------------------------------------
1 | ### Use with Fastly
2 |
3 | Example:
4 |
5 | ```
6 | export FASTLY_API_KEY=[FASTLY_API_KEY]
7 | export FASTLY_CUSTOMER_ID=[FASTLY_CUSTOMER_ID]
8 | ./terraformer import fastly -r service_v1,user
9 | ```
10 |
11 | List of supported Fastly resources:
12 |
13 | * `service_v1`
14 | * `fastly_service_acl_entries_v1`
15 | * `fastly_service_compute`
16 | * `fastly_service_dictionary_items_v1`
17 | * `fastly_service_dynamic_snippet_content_v1`
18 | * `fastly_service_v1`
19 | * `tls_subscription`
20 | * `fastly_tls_subscription`
21 | * `user`
22 | * `fastly_user_v1`
23 |
--------------------------------------------------------------------------------
/docs/github.md:
--------------------------------------------------------------------------------
1 | ### Use with GitHub
2 |
3 | Example:
4 |
5 | ```
6 | ./terraformer import github --owner=YOUR_ORGANIZATION --resources=repositories --token=YOUR_TOKEN // or GITHUB_TOKEN in env
7 | ./terraformer import github --owner=YOUR_ORGANIZATION --resources=repositories --filter=repository=id1:id2:id4 --token=YOUR_TOKEN // or GITHUB_TOKEN in env
8 |
9 | ./terraformer import github --owner=YOUR_ORGANIZATION --resources=repositories --base-url=https://your-enterprise-github-url
10 | ```
11 |
12 | Supports only organizational resources. List of supported resources:
13 |
14 | * `members`
15 | * `github_membership`
16 | * `organization_blocks`
17 | * `github_organization_block`
18 | * `organization_projects`
19 | * `github_organization_project`
20 | * `organization_webhooks`
21 | * `github_organization_webhook`
22 | * `repositories`
23 | * `github_branch_protection`
24 | * `github_repository`
25 | * `github_repository_collaborator`
26 | * `github_repository_deploy_key`
27 | * `github_repository_webhook`
28 | * `teams`
29 | * `github_team`
30 | * `github_team_membership`
31 | * `github_team_repository`
32 | * `user_ssh_keys`
33 | * `github_user_ssh_key`
34 |
35 | Notes:
36 | * Terraformer can't get webhook secrets from the GitHub API. If you use a secret token in any of your webhooks, running `terraform plan` will result in a change being detected:
37 | => `configuration.#: "1" => "0"` in tfstate only.
38 |
--------------------------------------------------------------------------------
/docs/gitlab.md:
--------------------------------------------------------------------------------
1 | ### Use with GitLab
2 |
3 | Example:
4 |
5 | ```shell
6 | ./terraformer import gitlab --group=GROUP_TO_IMPORT --resources=projects --token=YOUR_TOKEN # or GITLAB_TOKEN in env
7 | ./terraformer import gitlab --group=GROUP_TO_IMPORT --resources=groups --base-url=https://your-self-hosted-gitlab-domain/api/v4
8 | ```
9 |
10 | List of supported resources:
11 |
12 | * `groups`
13 | * `gitlab_group_membership`
14 | * `gitlab_group_variable`
15 | * `projects`
16 | * `gitlab_branch_protection`
17 | * `gitlab_project`
18 | * `gitlab_project_membership`
19 | * `gitlab_project_value`
20 | * `gitlab_tag_protection`
21 |
--------------------------------------------------------------------------------
/docs/gmailfilter.md:
--------------------------------------------------------------------------------
1 | ### Use with GmailFilter
2 |
3 | Support [Using Service Accounts](https://github.com/yamamoto-febc/terraform-provider-gmailfilter/blob/master/README.md#using-a-service-accountg-suite-users-only) or [Using Application Default Credentials](https://github.com/yamamoto-febc/terraform-provider-gmailfilter/blob/master/README.md#using-an-application-default-credential).
4 |
5 | Example:
6 |
7 | ```
8 | # Using Service Accounts
9 | export GOOGLE_CREDENTIALS=/path/to/client_secret.json
10 | export IMPERSONATED_USER_EMAIL="foobar@example.com"
11 |
12 | # Using Application Default Credentials
13 | gcloud auth application-default login \
14 | --client-id-file=client_secret.json \
15 | --scopes \
16 | https://www.googleapis.com/auth/gmail.labels,\
17 | https://www.googleapis.com/auth/gmail.settings.basic
18 |
19 | ./terraformer import gmailfilter -r=filter,label
20 | ```
21 |
22 | List of supported GmailFilter resources:
23 |
24 | * `filter`
25 | * `gmailfilter_filter`
26 | * `label`
27 | * `gmailfilter_label`
28 |
--------------------------------------------------------------------------------
/docs/honeycombio.md:
--------------------------------------------------------------------------------
1 | ### Use with Honeycomb.io
2 |
3 | #### Example
4 |
5 | ```sh
6 | export HONEYCOMB_API_KEY=MYAPIKEY
7 | ./terraformer import honeycombio --resources=board,trigger
8 | ```
9 |
10 | #### List of supported Honeycomb resources
11 |
12 | * `board`
13 | * `honeycombio_board`
14 | * `honeycombio_query`
15 | * `honeycombio_query_annotation`
16 | * `derived_column`
17 | * `honeycombio_derived_column`
18 | * `trigger`
19 | * `honeycombio_query`
20 | * `honeycombio_trigger`
21 | * `slo`
22 | * `honeycombio_burn_alert`
23 | * `honeycombio_derived_column`
24 | * `honeycombio_slo`
25 |
26 | #### A note about Environment-wide assets
27 |
28 | If no datasets are specified via the `--datasets` argument, and the API key is *not* for a Honeycomb Classic environment, the `__all__` dataset for Environment-wide assets (e.g. derived columns, boards) will be appended to the dataset list.
29 |
30 | If you wish to import a specific list of datasets *including* environment-wide assets (e.g. derived columns, boards) you must add `__all__` to the list of provided datasets.
31 |
32 | ```sh
33 | export HONEYCOMB_API_KEY=MYAPIKEY
34 | ./terraformer import honeycombio --resources=derived_column,board --datasets=__all__,my.service
35 | ```
36 |
--------------------------------------------------------------------------------
/docs/launchdarkly.md:
--------------------------------------------------------------------------------
1 | ### Use with Launchdarkly
2 |
3 | Example:
4 |
5 | ```
6 | export LAUNCHDARKLY_ACCESS_TOKEN=[LAUNCHDARKLY_ACCESS_TOKEN]
7 | ./terraformer import launchdarkly -r project
8 | ```
9 |
10 | List of supported LaunchDarkly resources:
11 |
12 | * `project`
13 | * `launchdarkly_project`
14 |
--------------------------------------------------------------------------------
/docs/linode.md:
--------------------------------------------------------------------------------
1 | ### Use with Linode
2 |
3 | Example:
4 |
5 | ```
6 | export LINODE_TOKEN=[LINODE_TOKEN]
7 | ./terraformer import linode -r instance
8 | ```
9 |
10 | List of supported Linode resources:
11 |
12 | * `domain`
13 | * `linode_domain`
14 | * `linode_domain_record`
15 | * `image`
16 | * `linode_image`
17 | * `instance`
18 | * `linode_instance`
19 | * `nodebalancer`
20 | * `linode_nodebalancer`
21 | * `linode_nodebalancer_config`
22 | * `linode_nodebalancer_node`
23 | * `rdns`
24 | * `linode_rdns`
25 | * `sshkey`
26 | * `linode_sshkey`
27 | * `stackscript`
28 | * `linode_stackscript`
29 | * `token`
30 | * `linode_token`
31 | * `volume`
32 | * `linode_volume`
33 |
--------------------------------------------------------------------------------
/docs/logz.md:
--------------------------------------------------------------------------------
1 | ### Use with Logz.io
2 |
3 | Example:
4 |
5 | ```
6 | LOGZIO_API_TOKEN=foobar LOGZIO_BASE_URL=https://api-eu.logz.io ./terraformer import logzio -r=alerts,alert_notification_endpoints // Import Logz.io alerts and alert notification endpoints
7 | ```
8 |
9 | List of supported Logz.io resources:
10 |
11 | * `alert_notification_endpoints`
12 | * `logzio_endpoint`
13 | * `alerts`
14 | * `logzio_alert`
15 |
--------------------------------------------------------------------------------
/docs/mackerel.md:
--------------------------------------------------------------------------------
1 | ### Use with Mackerel
2 |
3 | Example:
4 |
5 | ```bash
6 | ./terraformer import mackerel --resources=service --api-key=YOUR_MACKEREL_API_KEY // or MACKEREL_API_KEY in env --app-key=YOUR_MACKEREL_API_KEY
7 | ./terraformer import mackerel --resources=service --filter=service=name1:name2:name4 --api-key=YOUR_MACKEREL_API_KEY // or MACKEREL_API_KEY in env --app-key=YOUR_MACKEREL_API_KEY
8 | ./terraformer import mackerel --resources=aws_integration --filter=aws_integration=id1:id2:id4 --api-key=YOUR_MACKEREL_API_KEY // or MACKEREL_API_KEY in env --app-key=YOUR_MACKEREL_API_KEY
9 | ```
10 |
11 | List of supported Mackerel services:
12 |
13 | * `alert_group_setting`
14 | * `mackerel_alert_group_setting`
15 | * `aws_integration`
16 | * `mackerel_aws_integration`
17 | * Sensitive field `secret_key` is not generated and needs to be manually set
18 | * Sensitive field `external_id` is not generated and needs to be manually set
19 | * `channel`
20 | * `mackerel_channel`
21 | * `downtime`
22 | * `mackerel_downtime`
23 | * `monitor`
24 | * `mackerel_monitor`
25 | * `notification_group`
26 | * `mackerel_notification_group`
27 | * `role`
28 | * `mackerel_role`
29 | * `service`
30 | * `mackerel_service`
--------------------------------------------------------------------------------
/docs/mikrotik.md:
--------------------------------------------------------------------------------
1 | ### Use with [Mikrotik](https://wiki.mikrotik.com/wiki/Manual:TOC)
2 |
3 | This provider uses the [terraform-provider-mikrotik](https://github.com/ddelnano/terraform-provider-mikrotik). The terraformer provider was built by [Dom Del Nano](https://github.com/ddelnano).
4 |
5 | Example:
6 |
7 | ```
8 | ## Warning! You should not expose your mikrotik creds through your bash history. Export them to your shell in a safe way when doing this for real!
9 |
10 | MIKROTIK_HOST=router-hostname:8728 MIKROTIK_USER=username MIKROTIK_PASSWORD=password terraformer import mikrotik -r=dhcp_lease
11 |
12 | # Import only static IPs
13 | MIKROTIK_HOST=router-hostname:8728 MIKROTIK_USER=username MIKROTIK_PASSWORD=password terraformer import mikrotik -r=dhcp_lease --filter='Name=dynamic;Value=false'
14 | ```
15 |
16 | List of supported mikrotik resources:
17 |
18 | * `mikrotik_dhcp_lease`
--------------------------------------------------------------------------------
/docs/myrasec.md:
--------------------------------------------------------------------------------
1 | ### Use with Myra Security
2 |
3 | Example using a Myra Security API Key and corresponding Token:
4 |
5 | ```
6 | export MYRASEC_API_SECRET=[MYRASEC_API_SECRET]
7 | export MYRASEC_API_KEY=[MYRASEC_API_KEY]
8 | ./terraformer import myrasec --resources=domain
9 | ```
10 |
11 | List of supported Myra Security services:
12 |
13 | * `cache_setting`
14 | * `myrasec_cache_setting`
15 | * `dns_record`
16 | * `myrasec_dns_record`
17 | * `domain`
18 | * `myrasec_domain`
19 | * `error_page`
20 | * `myrasec_error_page`
21 | * `ip_filter`
22 | * `myrasec_ip_filter`
23 | * `maintenance`
24 | * `myrasec_maintenance`
25 | * `ratelimit`
26 | * `myrasec_ratelimit`
27 | * `redirect`
28 | * `myrasec_redirect`
29 | * `settings`
30 | * `myrasec_settings`
31 | * `waf_rule`
32 | * `myrasec_waf_rule`
33 |
--------------------------------------------------------------------------------
/docs/ns1.md:
--------------------------------------------------------------------------------
1 | ### Use with NS1
2 |
3 | Example:
4 |
5 | ```
6 | $ export NS1_APIKEY=[NS1_APIKEY]
7 | $ terraformer import ns1 -r zone,monitoringjob,team
8 | ```
9 |
10 | List of supported NS1 resources:
11 |
12 | * `monitoringjob`
13 | * `ns1_monitoringjob`
14 | * `team`
15 | * `ns1_team`
16 | * `zone`
17 | * `ns1_zone`
18 |
--------------------------------------------------------------------------------
/docs/octopus.md:
--------------------------------------------------------------------------------
1 | ### Use with OctopusDeploy
2 |
3 | Example:
4 |
5 | ```
6 | export OCTOPUS_CLI_SERVER=http://localhost:8081/
7 | export OCTOPUS_CLI_API_KEY=API-CK7DQ8BMJCUUBSHAJCDIATXUO
8 |
9 | terraformer import octopusdeploy --resources=tagsets
10 | ```
11 |
12 | * `accounts`
13 | * `octopusdeploy_account`
14 | * `certificates`
15 | * `octopusdeploy_certificate`
16 | * `environments`
17 | * `octopusdeploy_environment`
18 | * `feeds`
19 | * `octopusdeploy_feed`
20 | * `libraryvariablesets`
21 | * `octopusdeploy_library_variable_set`
22 | * `lifecycles`
23 | * `octopusdeploy_lifecycle`
24 | * `projects`
25 | * `octopusdeploy_project`
26 | * `projectgroups`
27 | * `octopusdeploy_project_group`
28 | * `projecttriggers`
29 | * `octopusdeploy_project_deployment_target_trigger`
30 | * `tagsets`
31 | * `octopusdeploy_tag_set`
32 |
--------------------------------------------------------------------------------
/docs/openstack.md:
--------------------------------------------------------------------------------
1 | ### Use with OpenStack
2 |
3 | Example:
4 |
5 | ```
6 | terraformer import openstack --resources=compute,networking --regions=RegionOne
7 | ```
8 |
9 | List of supported OpenStack services:
10 |
11 | * `blockstorage`
12 | * `openstack_blockstorage_volume_v1`
13 | * `openstack_blockstorage_volume_v2`
14 | * `openstack_blockstorage_volume_v3`
15 | * `compute`
16 | * `openstack_compute_instance_v2`
17 | * `networking`
18 | * `openstack_networking_secgroup_v2`
19 | * `openstack_networking_secgroup_rule_v2`
20 |
--------------------------------------------------------------------------------
/docs/opsgenie.md:
--------------------------------------------------------------------------------
1 | ### Use with Opsgenie
2 |
3 | Example:
4 |
5 | ```
6 | terraformer import opsgenie --resources=team,user --api-key=YOUR_API_KEY // or OPSGENIE_API_KEY in env
7 | ```
8 |
9 | List of supported Opsgenie services:
10 |
11 | * `team`
12 | * `opsgenie_team`
13 | * `user`
14 | * `opsgenie_user`
15 |
--------------------------------------------------------------------------------
/docs/pagerduty.md:
--------------------------------------------------------------------------------
1 | ### Use with PagerDuty
2 |
3 | Example:
4 |
5 | ```
6 | ./terraformer import pagerduty -r team,schedule,user -t YOUR_PAGERDUTY_TOKEN // or PAGERDUTY_TOKEN in env
7 | ```
8 | Instructions to obtain a Auth Token: https://developer.pagerduty.com/docs/rest-api-v2/authentication/
9 |
10 | List of supported PagerDuty resources:
11 |
12 | * `business_service`
13 | * `pagerduty_business_service`
14 | * `escalation_policy`
15 | * `pagerduty_escalation_policy`
16 | * `ruleset`
17 | * `pagerduty_ruleset`
18 | * `pagerduty_ruleset_rule`
19 | * `schedule`
20 | * `pagerduty_schedule`
21 | * `service`
22 | * `pagerduty_service`
23 | * `pagerduty_service_event_rule`
24 | * `team`
25 | * `pagerduty_team`
26 | * `pagerduty_team_membership`
27 | * `user`
28 | * `pagerduty_user`
29 |
--------------------------------------------------------------------------------
/docs/rabbitmq.md:
--------------------------------------------------------------------------------
1 | ### Use with RabbitMQ
2 |
3 | Example:
4 |
5 | ```
6 | export RABBITMQ_SERVER_URL=http://foo.bar.localdomain:15672
7 | export RABBITMQ_USERNAME=[RABBITMQ_USERNAME]
8 | export RABBITMQ_PASSWORD=[RABBITMQ_PASSWORD]
9 |
10 | terraformer import rabbitmq --resources=vhosts,queues,exchanges
11 | terraformer import rabbitmq --resources=vhosts,queues,exchanges --filter=vhost=name1:name2:name3
12 | ```
13 |
14 | All RabbitMQ resources that are currently supported by the RabbitMQ provider, are also supported by this module. Here is the list of resources which are currently supported by RabbitMQ provider v.1.1.0:
15 |
16 | * `bindings`
17 | * `rabbitmq_binding`
18 | * `exchanges`
19 | * `rabbitmq_exchange`
20 | * `permissions`
21 | * `rabbitmq_permissions`
22 | * `policies`
23 | * `rabbitmq_policy`
24 | * `queues`
25 | * `rabbitmq_queue`
26 | * `users`
27 | * `rabbitmq_user`
28 | * `vhosts`
29 | * `rabbitmq_vhost`
30 |
--------------------------------------------------------------------------------
/docs/relic.md:
--------------------------------------------------------------------------------
1 | ### Use with New Relic
2 |
3 | Example:
4 |
5 | ```
6 | ./terraformer import newrelic -r alert,infra,synthetics --api-key=NRAK-XXXXXXXX --account-id=XXXXX
7 | ```
8 |
9 | List of supported New Relic resources:
10 |
11 | * `alert`
12 | * `newrelic_alert_channel`
13 | * `newrelic_alert_condition`
14 | * `newrelic_alert_policy`
15 | * `newrelic_nrql_alert_condition`
16 | * `alertchannel`
17 | * `newrelic_alert_channel`
18 | * `alertcondition`
19 | * `newrelic_alert_condition`
20 | * `newrelic_nrql_alert_condition`
21 | * `alertpolicy`
22 | * `newrelic_alert_policy`
23 | * `infra`
24 | * `newrelic_infra_alert_condition`
25 | * `synthetics`
26 | * `newrelic_synthetics_monitor`
27 | * `tags`
28 | * `newrelic_entity_tags`
29 |
--------------------------------------------------------------------------------
/docs/tencentcloud.md:
--------------------------------------------------------------------------------
1 | ### Use with TencentCloud
2 |
3 | Example:
4 |
5 | ```
6 | $ export TENCENTCLOUD_SECRET_ID=
7 | $ export TENCENTCLOUD_SECRET_KEY=
8 | $ terraformer import tencentcloud --resources=cvm,cbs --regions=ap-guangzhou
9 | ```
10 |
11 | List of supported TencentCloud services:
12 |
13 | * `as`
14 | * `tencentcloud_as_scaling_config`
15 | * `tencentcloud_as_scaling_group`
16 | * `cbs`
17 | * `tencentcloud_cbs_storage`
18 | * `cdn`
19 | * `tencentcloud_cdn_domain`
20 | * `cfs`
21 | * `tencentcloud_cfs_file_system`
22 | * `clb`
23 | * `tencentcloud_clb_instance`
24 | * `cos`
25 | * `tencentcloud_cos_bucket`
26 | * `cvm`
27 | * `tencentcloud_instance`
28 | * `elasticsearch`
29 | * `tencentcloud_elasticsearch_instance`
30 | * `gaap`
31 | * `tencentcloud_gaap_proxy`
32 | * `tencentcloud_gaap_realserver`
33 | * `key_pair`
34 | * `tencentcloud_key_pair`
35 | * `mongodb`
36 | * `tencentcloud_mongodb_instance`
37 | * `mysql`
38 | * `tencentcloud_mysql_instance`
39 | * `tencentcloud_mysql_readonly_instance`
40 | * `redis`
41 | * `tencentcloud_redis_instance`
42 | * `scf`
43 | * `tencentcloud_scf_function`
44 | * `security_group`
45 | * `tencentcloud_security_group`
46 | * `ssl`
47 | * `tencentcloud_ssl_certificate`
48 | * `subnet`
49 | * `tencentcloud_subnet`
50 | * `tcaplus`
51 | * `tencentcloud_tcaplus_cluster`
52 | * `vpc`
53 | * `tencentcloud_vpc`
54 | * `vpn`
55 | * `tencentcloud_vpn_gateway`
56 |
--------------------------------------------------------------------------------
/docs/vultr.md:
--------------------------------------------------------------------------------
1 | ### Use with Vultr
2 |
3 | Example:
4 |
5 | ```
6 | export VULTR_API_KEY=[VULTR_API_KEY]
7 | ./terraformer import vultr -r server
8 | ```
9 |
10 | List of supported Vultr resources:
11 |
12 | * `bare_metal_server`
13 | * `vultr_bare_metal_server`
14 | * `block_storage`
15 | * `vultr_block_storage`
16 | * `dns_domain`
17 | * `vultr_dns_domain`
18 | * `vultr_dns_record`
19 | * `firewall_group`
20 | * `vultr_firewall_group`
21 | * `vultr_firewall_rule`
22 | * `network`
23 | * `vultr_network`
24 | * `reserved_ip`
25 | * `vultr_reserved_ip`
26 | * `server`
27 | * `vultr_server`
28 | * `snapshot`
29 | * `vultr_snapshot`
30 | * `ssh_key`
31 | * `vultr_ssh_key`
32 | * `startup_script`
33 | * `vultr_startup_script`
34 | * `user`
35 | * `vultr_user`
36 |
--------------------------------------------------------------------------------
/docs/xen.md:
--------------------------------------------------------------------------------
1 | ### Use with [Xen Orchestra](https://xen-orchestra.com/)
2 |
3 | This provider uses the [terraform-provider-xenorchestra](https://github.com/ddelnano/terraform-provider-xenorchestra). The terraformer provider was built by [Dom Del Nano](https://github.com/ddelnano) on behalf of [Vates SAS](https://vates.fr/) who is sponsoring Dom to work on the project.
4 |
5 | Example:
6 |
7 | ```
8 | ## Warning! You should not expose your xenorchestra creds through your bash history. Export them to your shell in a safe way when doing this for real!
9 |
10 | XOA_URL=ws://your-xenorchestra-domain XOA_USER=username XOA_PASSWORD=password terraformer import xenorchestra -r=acl
11 | ```
12 |
13 | List of supported xenorchestra resources:
14 |
15 | * `xenorchestra_acl`
16 | * `xenorchestra_resource_set`
17 |
--------------------------------------------------------------------------------
/docs/yandex.md:
--------------------------------------------------------------------------------
1 | ### Use with Yandex Cloud
2 |
3 | Example:
4 |
5 | ```
6 | export YC_TOKEN=[YANDEX_CLOUD_OAUTH_OR_IAM_TOKEN]
7 | ./terraformer import yandex -r subnet --folder_ids
8 | ```
9 |
10 | List of supported Yandex resources:
11 |
12 | * `disk`
13 | * `yandex_compute_disk`
14 | * `instance`
15 | * `yandex_compute_instance`
16 | * `network`
17 | * `yandex_vpc_network`
18 | * `subnet`
19 | * `yandex_vpc_subnet`
20 |
21 | Your `tf` and `tfstate` files are written by default to
22 | `generated/yandex/service`.
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package main
16 |
17 | import (
18 | "io"
19 | "log"
20 | "os"
21 | "strings"
22 |
23 | "github.com/GoogleCloudPlatform/terraformer/cmd"
24 | )
25 |
26 | type TerraformerWriter struct {
27 | io.Writer
28 | }
29 |
30 | func (t TerraformerWriter) Write(p []byte) (n int, err error) {
31 | if !strings.Contains(string(p), "[TRACE]") && !strings.Contains(string(p), "[DEBUG]") { // hide TF GRPC client log messages
32 | return os.Stdout.Write(p)
33 | }
34 | return len(p), nil
35 | }
36 |
37 | func main() {
38 | log.SetOutput(TerraformerWriter{})
39 | if err := cmd.Execute(); err != nil {
40 | log.Println(err)
41 | os.Exit(1)
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/providers/auth0/auth0_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package auth0
16 |
17 | import (
18 | "log"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "gopkg.in/auth0.v5/management"
22 | )
23 |
24 | type Auth0Service struct { //nolint
25 | terraformutils.Service
26 | }
27 |
28 | func (s *Auth0Service) generateClient() *management.Management {
29 | authenticationOption := management.WithClientCredentials(s.Args["client_id"].(string), s.Args["client_secret"].(string))
30 |
31 | apiClient, err := management.New(s.Args["domain"].(string),
32 | authenticationOption,
33 | management.WithDebug(false),
34 | )
35 | if err != nil {
36 | log.Fatalf("%v", err)
37 | }
38 |
39 | return apiClient
40 | }
41 |
--------------------------------------------------------------------------------
/providers/auth0/email.go:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package auth0
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | "gopkg.in/auth0.v5/management"
20 | )
21 |
22 | var (
23 | EmailAllowEmptyValues = []string{}
24 | )
25 |
26 | type EmailGenerator struct {
27 | Auth0Service
28 | }
29 |
30 | func (g EmailGenerator) createResources(email *management.Email) []terraformutils.Resource {
31 | resources := []terraformutils.Resource{}
32 | resourceName := *email.Name
33 | resources = append(resources, terraformutils.NewSimpleResource(
34 | resourceName,
35 | resourceName,
36 | "auth0_email",
37 | "auth0",
38 | EmailAllowEmptyValues,
39 | ))
40 | return resources
41 | }
42 |
43 | func (g *EmailGenerator) InitResources() error {
44 | m := g.generateClient()
45 | Email, err := m.Email.Read()
46 | if err != nil {
47 | return err
48 | }
49 | g.Resources = g.createResources(Email)
50 | return nil
51 | }
52 |
--------------------------------------------------------------------------------
/providers/auth0/prompt.go:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package auth0
16 |
17 | import (
18 | "encoding/base64"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "gopkg.in/auth0.v5/management"
22 | )
23 |
24 | var (
25 | PromptAllowEmptyValues = []string{}
26 | )
27 |
28 | type PromptGenerator struct {
29 | Auth0Service
30 | }
31 |
32 | func (g PromptGenerator) createResources(prompt *management.Prompt) []terraformutils.Resource {
33 | resources := []terraformutils.Resource{}
34 | resourceName := base64.StdEncoding.EncodeToString([]byte(prompt.String()))
35 | resources = append(resources, terraformutils.NewSimpleResource(
36 | resourceName,
37 | resourceName,
38 | "auth0_prompt",
39 | "auth0",
40 | PromptAllowEmptyValues,
41 | ))
42 | return resources
43 | }
44 |
45 | func (g *PromptGenerator) InitResources() error {
46 | m := g.generateClient()
47 | prompt, err := m.Prompt.Read()
48 | if err != nil {
49 | return err
50 | }
51 | g.Resources = g.createResources(prompt)
52 | return nil
53 | }
54 |
--------------------------------------------------------------------------------
/providers/aws/appsync.go:
--------------------------------------------------------------------------------
1 | package aws
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
7 | "github.com/aws/aws-sdk-go-v2/service/appsync"
8 | )
9 |
10 | type AppSyncGenerator struct {
11 | AWSService
12 | }
13 |
14 | func (g *AppSyncGenerator) InitResources() error {
15 | config, e := g.generateConfig()
16 | if e != nil {
17 | return e
18 | }
19 |
20 | svc := appsync.NewFromConfig(config)
21 |
22 | var nextToken *string
23 | for {
24 | apis, err := svc.ListGraphqlApis(context.TODO(), &appsync.ListGraphqlApisInput{
25 | NextToken: nextToken,
26 | })
27 | if err != nil {
28 | return err
29 | }
30 |
31 | for _, api := range apis.GraphqlApis {
32 | var id = *api.ApiId
33 | var name = *api.Name
34 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
35 | id,
36 | name,
37 | "aws_appsync_graphql_api",
38 | "aws",
39 | []string{}))
40 | }
41 | nextToken = apis.NextToken
42 | if nextToken == nil {
43 | break
44 | }
45 | }
46 |
47 | return nil
48 | }
49 |
--------------------------------------------------------------------------------
/providers/aws/sfn.go:
--------------------------------------------------------------------------------
1 | package aws
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
7 | "github.com/aws/aws-sdk-go-v2/service/sfn"
8 | )
9 |
10 | var sfnAllowEmptyValues = []string{"tags."}
11 |
12 | type SfnGenerator struct {
13 | AWSService
14 | }
15 |
16 | func (g *SfnGenerator) InitResources() error {
17 | config, e := g.generateConfig()
18 | if e != nil {
19 | return e
20 | }
21 | svc := sfn.NewFromConfig(config)
22 |
23 | p := sfn.NewListStateMachinesPaginator(svc, &sfn.ListStateMachinesInput{})
24 | for p.HasMorePages() {
25 | page, err := p.NextPage(context.TODO())
26 | if err != nil {
27 | return err
28 | }
29 | for _, stateMachine := range page.StateMachines {
30 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
31 | *stateMachine.StateMachineArn,
32 | *stateMachine.Name,
33 | "aws_sfn_state_machine",
34 | "aws",
35 | sfnAllowEmptyValues,
36 | ))
37 | }
38 | }
39 |
40 | pActivity := sfn.NewListActivitiesPaginator(svc, &sfn.ListActivitiesInput{})
41 | for pActivity.HasMorePages() {
42 | pActivityNextPage, err := pActivity.NextPage(context.TODO())
43 | if err != nil {
44 | return err
45 | }
46 | for _, stateMachine := range pActivityNextPage.Activities {
47 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
48 | *stateMachine.ActivityArn,
49 | *stateMachine.Name,
50 | "aws_sfn_activity",
51 | "aws",
52 | sfnAllowEmptyValues,
53 | ))
54 | }
55 | }
56 |
57 | return nil
58 | }
59 |
--------------------------------------------------------------------------------
/providers/aws/swf.go:
--------------------------------------------------------------------------------
1 | package aws
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
7 | "github.com/aws/aws-sdk-go-v2/service/swf"
8 | "github.com/aws/aws-sdk-go-v2/service/swf/types"
9 | )
10 |
11 | type SWFGenerator struct {
12 | AWSService
13 | }
14 |
15 | func (g *SWFGenerator) InitResources() error {
16 | regStatuses := []types.RegistrationStatus{types.RegistrationStatusRegistered, types.RegistrationStatusDeprecated}
17 | config, e := g.generateConfig()
18 | if e != nil {
19 | return e
20 | }
21 | svc := swf.NewFromConfig(config)
22 | for _, status := range regStatuses {
23 | p := swf.NewListDomainsPaginator(svc, &swf.ListDomainsInput{RegistrationStatus: status})
24 | for p.HasMorePages() {
25 | page, err := p.NextPage(context.TODO())
26 | if err != nil {
27 | return err
28 | }
29 | for _, domain := range page.DomainInfos {
30 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
31 | *domain.Name,
32 | *domain.Name,
33 | "aws_swf_domain",
34 | "aws",
35 | []string{},
36 | ))
37 | }
38 | }
39 | }
40 | return nil
41 | }
42 |
--------------------------------------------------------------------------------
/providers/aws/xray.go:
--------------------------------------------------------------------------------
1 | package aws
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
7 | "github.com/aws/aws-sdk-go-v2/service/xray"
8 | )
9 |
10 | var xrayAllowEmptyValues = []string{"tags."}
11 |
12 | type XrayGenerator struct {
13 | AWSService
14 | }
15 |
16 | func (g *XrayGenerator) InitResources() error {
17 | config, e := g.generateConfig()
18 | if e != nil {
19 | return e
20 | }
21 | svc := xray.NewFromConfig(config)
22 |
23 | p := xray.NewGetSamplingRulesPaginator(svc, &xray.GetSamplingRulesInput{})
24 | for p.HasMorePages() {
25 | page, err := p.NextPage(context.TODO())
26 | if err != nil {
27 | return err
28 | }
29 | for _, samplingRule := range page.SamplingRuleRecords {
30 | // NOTE: Builtin rule with unmodifiable name and 10000 prirority (lowest)
31 | if *samplingRule.SamplingRule.RuleName != "Default" {
32 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
33 | *samplingRule.SamplingRule.RuleName,
34 | *samplingRule.SamplingRule.RuleName,
35 | "aws_xray_sampling_rule",
36 | "aws",
37 | xrayAllowEmptyValues))
38 | }
39 | }
40 | }
41 |
42 | return nil
43 | }
44 |
--------------------------------------------------------------------------------
/providers/azuread/application.go:
--------------------------------------------------------------------------------
1 | // ApplicationServiceGenerator
2 | package azuread
3 |
4 | import (
5 | "context"
6 | "log"
7 |
8 | "github.com/manicminer/hamilton/msgraph"
9 | "github.com/manicminer/hamilton/odata"
10 | )
11 |
12 | type ApplicationServiceGenerator struct {
13 | AzureADService
14 | }
15 |
16 | func (az *ApplicationServiceGenerator) listResources() ([]msgraph.Application, error) {
17 | client, fail := az.getApplicationsClient()
18 | client.BaseClient.DisableRetries = true
19 |
20 | var resources []msgraph.Application
21 |
22 | if fail != nil {
23 | return nil, fail
24 | }
25 | ctx := context.Background()
26 |
27 | applications, _, err := client.List(ctx, odata.Query{})
28 | if err != nil {
29 | return nil, err
30 | }
31 |
32 | for _, application := range *applications {
33 | resources = append(resources, application)
34 | }
35 |
36 | return resources, nil
37 | }
38 |
39 | func (az *ApplicationServiceGenerator) appendResource(resource *msgraph.Application) {
40 | id := resource.ID
41 | az.appendSimpleResource(*id, *resource.DisplayName, "azuread_application")
42 | }
43 |
44 | func (az *ApplicationServiceGenerator) InitResources() error {
45 |
46 | resources, err := az.listResources()
47 | if err != nil {
48 | return err
49 | }
50 | for _, resource := range resources {
51 | log.Println(*resource.DisplayName)
52 | az.appendResource(&resource)
53 | }
54 | return nil
55 | }
56 |
57 | func (az *ApplicationServiceGenerator) GetResourceConnections() map[string][]string {
58 |
59 | return map[string][]string{
60 | "application": {"id"},
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/providers/azuread/group.go:
--------------------------------------------------------------------------------
1 | // UserServiceGenerator
2 | package azuread
3 |
4 | import (
5 | "context"
6 | "log"
7 |
8 | "github.com/manicminer/hamilton/msgraph"
9 | "github.com/manicminer/hamilton/odata"
10 | )
11 |
12 | type GroupServiceGenerator struct {
13 | AzureADService
14 | }
15 |
16 | func (az *GroupServiceGenerator) listResources() ([]msgraph.Group, error) {
17 | client, fail := az.getGroupsClient()
18 | client.BaseClient.DisableRetries = true
19 |
20 | var resources []msgraph.Group
21 |
22 | if fail != nil {
23 | return nil, fail
24 | }
25 | ctx := context.Background()
26 |
27 | groups, _, err := client.List(ctx, odata.Query{})
28 | if err != nil {
29 | return nil, err
30 | }
31 |
32 | for _, group := range *groups {
33 | resources = append(resources, group)
34 | }
35 |
36 | return resources, nil
37 | }
38 |
39 | func (az *GroupServiceGenerator) appendResource(resource *msgraph.Group) {
40 | id := resource.ID
41 | az.appendSimpleResource(*id, *resource.DisplayName+"-"+*id, "azuread_group")
42 | }
43 |
44 | func (az *GroupServiceGenerator) InitResources() error {
45 |
46 | resources, err := az.listResources()
47 | if err != nil {
48 | return err
49 | }
50 | for _, resource := range resources {
51 | log.Println(*resource.DisplayName)
52 | az.appendResource(&resource)
53 | }
54 | return nil
55 | }
56 |
57 | func (az *GroupServiceGenerator) GetResourceConnections() map[string][]string {
58 |
59 | return map[string][]string{
60 | "group": {"id"},
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/providers/azuread/user.go:
--------------------------------------------------------------------------------
1 | // UserServiceGenerator
2 | package azuread
3 |
4 | import (
5 | "context"
6 | "log"
7 |
8 | "github.com/manicminer/hamilton/msgraph"
9 | "github.com/manicminer/hamilton/odata"
10 | )
11 |
12 | type UserServiceGenerator struct {
13 | AzureADService
14 | }
15 |
16 | func (az *UserServiceGenerator) listResources() ([]msgraph.User, error) {
17 | client, fail := az.getUserClient()
18 | client.BaseClient.DisableRetries = true
19 |
20 | var resources []msgraph.User
21 |
22 | if fail != nil {
23 | return nil, fail
24 | }
25 | ctx := context.Background()
26 |
27 | users, _, err := client.List(ctx, odata.Query{})
28 | if err != nil {
29 | return nil, err
30 | }
31 |
32 | for _, user := range *users {
33 | resources = append(resources, user)
34 | }
35 |
36 | return resources, nil
37 | }
38 |
39 | func (az *UserServiceGenerator) appendResource(resource *msgraph.User) {
40 | id := resource.ID
41 | az.appendSimpleResource(*id, *resource.DisplayName, "azuread_user")
42 | }
43 |
44 | func (az *UserServiceGenerator) InitResources() error {
45 |
46 | resources, err := az.listResources()
47 | if err != nil {
48 | return err
49 | }
50 | for _, resource := range resources {
51 | log.Println(*resource.DisplayName)
52 | az.appendResource(&resource)
53 | }
54 | return nil
55 | }
56 |
57 | func (az *UserServiceGenerator) GetResourceConnections() map[string][]string {
58 |
59 | return map[string][]string{
60 | "user": {"id"},
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/providers/azuredevops/git_repository.go:
--------------------------------------------------------------------------------
1 | package azuredevops
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/microsoft/azure-devops-go-api/azuredevops/git"
7 | )
8 |
9 | type GitRepositoryGenerator struct {
10 | AzureDevOpsService
11 | }
12 |
13 | func (az *GitRepositoryGenerator) listResources() ([]git.GitRepository, error) {
14 |
15 | client, err := az.getGitClient()
16 | if err != nil {
17 | return nil, err
18 | }
19 | ctx := context.Background()
20 | resources, err := client.GetRepositories(ctx, git.GetRepositoriesArgs{})
21 | if err != nil {
22 | return nil, err
23 | }
24 | return *resources, nil
25 | }
26 |
27 | func (az *GitRepositoryGenerator) appendResource(resource *git.GitRepository) {
28 |
29 | id := *resource.Id
30 | az.appendSimpleResource(id.String(), *resource.Name, "azuredevops_git_repository")
31 | }
32 |
33 | func (az *GitRepositoryGenerator) InitResources() error {
34 |
35 | resources, err := az.listResources()
36 | if err != nil {
37 | return err
38 | }
39 | for _, resource := range resources {
40 | az.appendResource(&resource)
41 | }
42 | return nil
43 | }
44 |
45 | func (az *GitRepositoryGenerator) GetResourceConnections() map[string][]string {
46 |
47 | return map[string][]string{
48 | "project": {"project_id", "id"},
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/providers/azuredevops/group.go:
--------------------------------------------------------------------------------
1 | package azuredevops
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/microsoft/azure-devops-go-api/azuredevops/graph"
7 | )
8 |
9 | type GroupGenerator struct {
10 | AzureDevOpsService
11 | }
12 |
13 | func (az *GroupGenerator) listResources() ([]graph.GraphGroup, error) {
14 |
15 | client, fail := az.getGraphClient()
16 | if fail != nil {
17 | return nil, fail
18 | }
19 | ctx := context.Background()
20 | var resources []graph.GraphGroup
21 | pageArgs := graph.ListGroupsArgs{}
22 | pages, err := client.ListGroups(ctx, pageArgs)
23 | for ; err == nil; pages, err = client.ListGroups(ctx, pageArgs) {
24 | resources = append(resources, *pages.GraphGroups...)
25 | if pages.ContinuationToken == nil {
26 | return resources, nil
27 | }
28 | pageArgs = graph.ListGroupsArgs{
29 | ContinuationToken: &(*pages.ContinuationToken)[0],
30 | }
31 | }
32 | return nil, err
33 | }
34 |
35 | func (az *GroupGenerator) appendResource(resource *graph.GraphGroup) {
36 |
37 | resourceName := firstNonEmpty(resource.DisplayName, resource.MailAddress, resource.OriginId)
38 | az.appendSimpleResource(*resource.Descriptor, *resourceName, "azuredevops_group")
39 | }
40 |
41 | func (az *GroupGenerator) InitResources() error {
42 |
43 | resources, err := az.listResources()
44 | if err != nil {
45 | return err
46 | }
47 | for _, resource := range resources {
48 | az.appendResource(&resource)
49 | }
50 | return nil
51 | }
52 |
53 | func (az *GroupGenerator) GetResourceConnections() map[string][]string {
54 |
55 | return map[string][]string{
56 | "project": {"scope", "id"},
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/providers/azuredevops/helpers.go:
--------------------------------------------------------------------------------
1 | package azuredevops
2 |
3 | func firstNonEmpty(values ...*string) *string {
4 | for _, val := range values {
5 | if val != nil {
6 | if len(*val) > 0 {
7 | return val
8 | }
9 | }
10 | }
11 | return nil
12 | }
13 |
--------------------------------------------------------------------------------
/providers/azuredevops/project.go:
--------------------------------------------------------------------------------
1 | package azuredevops
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/microsoft/azure-devops-go-api/azuredevops/core"
7 | )
8 |
9 | type ProjectGenerator struct {
10 | AzureDevOpsService
11 | }
12 |
13 | func (az *ProjectGenerator) listResources() ([]core.TeamProjectReference, error) {
14 | client, fail := az.getCoreClient()
15 | if fail != nil {
16 | return nil, fail
17 | }
18 | ctx := context.Background()
19 | var resources []core.TeamProjectReference
20 | pageArgs := core.GetProjectsArgs{}
21 | pages, err := client.GetProjects(ctx, pageArgs)
22 | for ; err == nil; pages, err = client.GetProjects(ctx, pageArgs) {
23 | fetched := *pages
24 | items := fetched.Value
25 | resources = append(resources, items...)
26 | if pages.ContinuationToken == "" {
27 | return resources, nil
28 | }
29 | pageArgs = core.GetProjectsArgs{
30 | ContinuationToken: &pages.ContinuationToken,
31 | }
32 | }
33 | return nil, err
34 | }
35 |
36 | func (az *ProjectGenerator) appendResource(resource *core.TeamProjectReference) {
37 | id := *resource.Id
38 | az.appendSimpleResource(id.String(), *resource.Name, "azuredevops_project")
39 | }
40 |
41 | func (az *ProjectGenerator) InitResources() error {
42 |
43 | resources, err := az.listResources()
44 | if err != nil {
45 | return err
46 | }
47 | for _, resource := range resources {
48 | az.appendResource(&resource)
49 | }
50 | return nil
51 | }
52 |
--------------------------------------------------------------------------------
/providers/commercetools/commercetools_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package commercetools
16 |
17 | import "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 |
19 | type CommercetoolsService struct { //nolint
20 | terraformutils.Service
21 | }
22 |
--------------------------------------------------------------------------------
/providers/commercetools/connectivity/client.go:
--------------------------------------------------------------------------------
1 | package connectivity
2 |
3 | import (
4 | "context"
5 | "strings"
6 |
7 | "github.com/labd/commercetools-go-sdk/commercetools"
8 | "golang.org/x/oauth2/clientcredentials"
9 | )
10 |
11 | func (c *Config) NewClient() *commercetools.Client {
12 | oauth2Config := &clientcredentials.Config{
13 | ClientID: c.ClientID,
14 | ClientSecret: c.ClientSecret,
15 | Scopes: strings.Split(c.ClientScope, " "),
16 | TokenURL: c.TokenURL,
17 | }
18 |
19 | httpClient := oauth2Config.Client(context.TODO())
20 |
21 | return commercetools.New(&commercetools.Config{
22 | ProjectKey: c.ProjectKey,
23 | URL: c.BaseURL,
24 | HTTPClient: httpClient,
25 | LibraryName: "terraformer",
26 | })
27 | }
28 |
--------------------------------------------------------------------------------
/providers/commercetools/connectivity/config.go:
--------------------------------------------------------------------------------
1 | package connectivity
2 |
3 | type Config struct {
4 | ClientID string
5 | ClientSecret string
6 | ClientScope string
7 | ProjectKey string
8 | TokenURL string
9 | BaseURL string
10 | }
11 |
--------------------------------------------------------------------------------
/providers/commercetools/helpers.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package commercetools
16 |
17 | import (
18 | "regexp"
19 | "strings"
20 | )
21 |
22 | // Making resource's name less ugly
23 | func normalizeResourceName(s string) string {
24 | specialChars := `<>()*#{}[]|@_ .%'",&`
25 | for _, c := range specialChars {
26 | s = strings.ReplaceAll(s, string(c), "-")
27 | }
28 |
29 | s = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, "")
30 | s = strings.TrimSuffix(s, "-")
31 |
32 | return strings.ToLower(s)
33 | }
34 |
--------------------------------------------------------------------------------
/providers/datadog/datadog_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package datadog
16 |
17 | import "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 |
19 | type DatadogService struct { //nolint
20 | terraformutils.Service
21 | }
22 |
--------------------------------------------------------------------------------
/providers/datadog/logs_archive_order.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package datadog
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | var (
22 | // LogsArchiveOrderAllowEmptyValues ...
23 | LogsArchiveOrderAllowEmptyValues = []string{}
24 | )
25 |
26 | // LogsArchiveOrderGenerator ...
27 | type LogsArchiveOrderGenerator struct {
28 | DatadogService
29 | }
30 |
31 | // InitResources Generate TerraformResources
32 | func (g *LogsArchiveOrderGenerator) InitResources() error {
33 | g.Resources = append(g.Resources, terraformutils.NewResource(
34 | "archiveOrderID",
35 | "archiveOrderID",
36 | "datadog_logs_archive_order",
37 | "datadog",
38 | map[string]string{},
39 | LogsArchiveOrderAllowEmptyValues,
40 | map[string]interface{}{},
41 | ))
42 | return nil
43 | }
44 |
--------------------------------------------------------------------------------
/providers/datadog/logs_index_order.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package datadog
16 |
17 | import (
18 | "fmt"
19 | "time"
20 |
21 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
22 | )
23 |
24 | var (
25 | // LogsIndexOrderAllowEmptyValues ...
26 | LogsIndexOrderAllowEmptyValues = []string{}
27 | )
28 |
29 | // LogsIndexOrderGenerator ...
30 | type LogsIndexOrderGenerator struct {
31 | DatadogService
32 | }
33 |
34 | // InitResources Generate TerraformResources
35 | func (g *LogsIndexOrderGenerator) InitResources() error {
36 | currentDate := time.Now().Format("20060102150405")
37 | resourceName := fmt.Sprintf("logs_index_order_%s", currentDate)
38 | g.Resources = append(g.Resources, terraformutils.NewResource(
39 | resourceName,
40 | resourceName,
41 | "datadog_logs_index_order",
42 | "datadog",
43 | map[string]string{
44 | "name": resourceName,
45 | },
46 | LogsIndexOrderAllowEmptyValues,
47 | map[string]interface{}{},
48 | ))
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/datadog/logs_pipeline_order.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package datadog
16 |
17 | import (
18 | "fmt"
19 | "time"
20 |
21 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
22 | )
23 |
24 | var (
25 | // LogsPipelineOrderAllowEmptyValues ...
26 | LogsPipelineOrderAllowEmptyValues = []string{}
27 | )
28 |
29 | // LogsPipelineOrderGenerator ...
30 | type LogsPipelineOrderGenerator struct {
31 | DatadogService
32 | }
33 |
34 | // InitResources Generate TerraformResources
35 | func (g *LogsPipelineOrderGenerator) InitResources() error {
36 | currentDate := time.Now().Format("20060102150405")
37 | resourceName := fmt.Sprintf("logs_pipeline_order_%s", currentDate)
38 | g.Resources = append(g.Resources, terraformutils.NewResource(
39 | resourceName,
40 | resourceName,
41 | "datadog_logs_pipeline_order",
42 | "datadog",
43 | map[string]string{
44 | "name": resourceName,
45 | },
46 | LogsPipelineOrderAllowEmptyValues,
47 | map[string]interface{}{},
48 | ))
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/digitalocean/digitalocean_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package digitalocean
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/digitalocean/godo"
22 | "golang.org/x/oauth2"
23 | )
24 |
25 | type DigitalOceanService struct { //nolint
26 | terraformutils.Service
27 | }
28 |
29 | func (s *DigitalOceanService) generateClient() *godo.Client {
30 | tokenSource := &TokenSource{
31 | AccessToken: s.Args["token"].(string),
32 | }
33 | oauthClient := oauth2.NewClient(context.Background(), tokenSource)
34 | client := godo.NewClient(oauthClient)
35 | return client
36 | }
37 |
--------------------------------------------------------------------------------
/providers/digitalocean/token_source.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package digitalocean
16 |
17 | import "golang.org/x/oauth2"
18 |
19 | type TokenSource struct {
20 | AccessToken string
21 | }
22 |
23 | func (t *TokenSource) Token() (*oauth2.Token, error) {
24 | token := &oauth2.Token{
25 | AccessToken: t.AccessToken,
26 | }
27 | return token, nil
28 | }
29 |
--------------------------------------------------------------------------------
/providers/equinixmetal/equinixmetal_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2021 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package equinixmetal
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | "github.com/packethost/packngo"
20 | )
21 |
22 | type EquinixMetalService struct { //nolint
23 | terraformutils.Service
24 | }
25 |
26 | func (s *EquinixMetalService) generateClient() *packngo.Client {
27 | client, _ := packngo.NewClient()
28 | return client
29 | }
30 |
--------------------------------------------------------------------------------
/providers/fastly/fastly_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package fastly
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | type FastlyService struct { //nolint
22 | terraformutils.Service
23 | }
24 |
--------------------------------------------------------------------------------
/providers/gcp/gcp_compute_code_generator/backendServices.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package main
16 |
17 | type backendServices struct {
18 | basicGCPResource
19 | }
20 |
21 | func (b backendServices) ifNeedRegion() bool {
22 | return false
23 | }
24 |
--------------------------------------------------------------------------------
/providers/gcp/gcp_compute_code_generator/globalForwardingRules.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package main
16 |
17 | type globalForwardingRules struct {
18 | basicGCPResource
19 | }
20 |
21 | func (b globalForwardingRules) ifNeedRegion() bool {
22 | return false
23 | }
24 |
--------------------------------------------------------------------------------
/providers/gcp/gcp_compute_code_generator/instanceGroupManagers.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package main
16 |
17 | type instanceGroupManagers struct {
18 | basicGCPResource
19 | }
20 |
21 | func (b instanceGroupManagers) ifNeedZone(zoneInParameters bool) bool {
22 | return true
23 | }
24 |
25 | func (b instanceGroupManagers) ifIDWithZone(zoneInParameters bool) bool {
26 | return false
27 | }
28 | func (b instanceGroupManagers) ifNeedRegion() bool {
29 | return false
30 | }
31 |
--------------------------------------------------------------------------------
/providers/gcp/gcp_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package gcp
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | type GCPService struct { //nolint
22 | terraformutils.Service
23 | }
24 |
25 | func (s *GCPService) applyCustomProviderType(resources []terraformutils.Resource, providerName string) []terraformutils.Resource {
26 | editedResources := []terraformutils.Resource{}
27 | for _, r := range resources {
28 | r.Item["provider"] = providerName
29 | editedResources = append(editedResources, r)
30 | }
31 | return editedResources
32 | }
33 |
--------------------------------------------------------------------------------
/providers/gcp/project.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package gcp
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | var projectAllowEmptyValues = []string{""}
22 |
23 | var projectAdditionalFields = map[string]interface{}{}
24 |
25 | type ProjectGenerator struct {
26 | GCPService
27 | }
28 |
29 | // Generate TerraformResources from GCP API,
30 | func (g *ProjectGenerator) InitResources() error {
31 | g.Resources = append(g.Resources, terraformutils.NewResource(
32 | g.GetArgs()["project"].(string),
33 | g.GetArgs()["project"].(string),
34 | "google_project",
35 | g.ProviderName,
36 | map[string]string{
37 | "auto_create_network": "true",
38 | },
39 | projectAllowEmptyValues,
40 | projectAdditionalFields,
41 | ))
42 |
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/github/github_organization.go:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package github
16 |
17 | import (
18 | "context"
19 | )
20 |
21 | type OrganizationGenerator struct {
22 | GithubService
23 | }
24 |
25 | // Generate TerraformResources from Github API
26 | func (g *OrganizationGenerator) InitResources() error {
27 | ctx := context.Background()
28 | client, err := g.createClient()
29 | if err != nil {
30 | return err
31 | }
32 |
33 | owner := g.Args["owner"].(string)
34 | g.Resources = append(g.Resources, createMembershipsResources(ctx, client, owner)...)
35 | g.Resources = append(g.Resources, createOrganizationBlocksResources(ctx, client, owner)...)
36 | g.Resources = append(g.Resources, createOrganizationProjects(ctx, client, owner)...)
37 |
38 | return nil
39 | }
40 |
--------------------------------------------------------------------------------
/providers/gitlab/gitlab_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package gitlab
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | "github.com/xanzy/go-gitlab"
20 | )
21 |
22 | const gitLabDefaultURL = "https://gitlab.com/api/v4/"
23 |
24 | type GitLabService struct { //nolint
25 | terraformutils.Service
26 | }
27 |
28 | func (g *GitLabService) createClient() (*gitlab.Client, error) {
29 | if g.GetArgs()["base_url"].(string) == gitLabDefaultURL {
30 | return g.createRegularClient()
31 | }
32 | return g.createEnterpriseClient()
33 | }
34 |
35 | func (g *GitLabService) createRegularClient() (*gitlab.Client, error) {
36 | return gitlab.NewClient(g.Args["token"].(string))
37 | }
38 |
39 | func (g *GitLabService) createEnterpriseClient() (*gitlab.Client, error) {
40 | return gitlab.NewClient(g.Args["token"].(string), gitlab.WithBaseURL(g.GetArgs()["base_url"].(string)))
41 | }
42 |
--------------------------------------------------------------------------------
/providers/grafana/folder.go:
--------------------------------------------------------------------------------
1 | package grafana
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
7 | gapi "github.com/grafana/grafana-api-golang-client"
8 | )
9 |
10 | type FolderGenerator struct {
11 | GrafanaService
12 | }
13 |
14 | func (g *FolderGenerator) InitResources() error {
15 | client, err := g.buildClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to build grafana client: %v", err)
18 | }
19 |
20 | err = g.createFolderResources(client)
21 | if err != nil {
22 | return err
23 | }
24 |
25 | return nil
26 | }
27 |
28 | func (g *FolderGenerator) createFolderResources(client *gapi.Client) error {
29 | folders, err := client.Folders()
30 | if err != nil {
31 | return fmt.Errorf("unable to list grafana folders: %v", err)
32 | }
33 |
34 | for _, folder := range folders {
35 | g.Resources = append(g.Resources, terraformutils.NewResource(
36 | fmt.Sprint(folder.ID),
37 | folder.Title,
38 | "grafana_folder",
39 | "grafana",
40 | map[string]string{
41 | "uid": folder.UID,
42 | },
43 | []string{},
44 | map[string]interface{}{},
45 | ))
46 | }
47 |
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/heroku/heroku_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package heroku
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | heroku "github.com/heroku/heroku-go/v5"
20 | )
21 |
22 | type HerokuService struct { //nolint
23 | terraformutils.Service
24 | }
25 |
26 | func (s *HerokuService) generateService() *heroku.Service {
27 | heroku.DefaultTransport.Password = s.Args["api_key"].(string)
28 | heroku.DefaultTransport.Debug = s.Verbose
29 | return heroku.NewService(heroku.DefaultClient)
30 | }
31 |
--------------------------------------------------------------------------------
/providers/heroku/pipeline.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package heroku
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | heroku "github.com/heroku/heroku-go/v5"
22 | )
23 |
24 | type PipelineGenerator struct {
25 | HerokuService
26 | }
27 |
28 | func (g PipelineGenerator) createResources(pipelineList []heroku.Pipeline) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, pipeline := range pipelineList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | pipeline.ID,
33 | pipeline.Name,
34 | "heroku_pipeline",
35 | "heroku",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *PipelineGenerator) InitResources() error {
42 | svc := g.generateService()
43 | output, err := svc.PipelineList(context.TODO(), &heroku.ListRange{Field: "id"})
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/honeycombio/board.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type BoardGenerator struct {
11 | HoneycombService
12 | }
13 |
14 | func (g *BoardGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | boards, err := client.Boards.List(context.TODO())
21 | if err != nil {
22 | return fmt.Errorf("unable to list Honeycomb boards: %v", err)
23 | }
24 |
25 | for _, board := range boards {
26 | // all of a board's queries must be in our list of target datasets or we don't import it
27 | onlyValidDatasets := true
28 | for _, query := range board.Queries {
29 | if query.Dataset == "" {
30 | // assume an unset dataset is an environment-wide query
31 | query.Dataset = environmentWideDatasetSlug
32 | }
33 | if _, exists := g.datasets[query.Dataset]; !exists {
34 | onlyValidDatasets = false
35 | break
36 | }
37 | }
38 |
39 | if onlyValidDatasets {
40 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
41 | board.ID,
42 | board.ID,
43 | "honeycombio_board",
44 | "honeycombio",
45 | []string{},
46 | ))
47 | }
48 | }
49 |
50 | return nil
51 | }
52 |
--------------------------------------------------------------------------------
/providers/honeycombio/burn_alert.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type BurnAlertGenerator struct {
11 | HoneycombService
12 | }
13 |
14 | func (g *BurnAlertGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | for _, dataset := range g.datasets {
21 | if dataset.Slug == environmentWideDatasetSlug {
22 | // environment-wide Burn Alerts are not supported
23 | continue
24 | }
25 | slos, err := client.SLOs.List(context.TODO(), dataset.Slug)
26 | if err != nil {
27 | return fmt.Errorf("unable to list Honeycomb SLOs for dataset %q: %v", dataset.Slug, err)
28 | }
29 |
30 | for _, slo := range slos {
31 | bas, _ := client.BurnAlerts.ListForSLO(context.TODO(), dataset.Slug, slo.ID)
32 | for _, ba := range bas {
33 | g.Resources = append(g.Resources, terraformutils.NewResource(
34 | ba.ID,
35 | ba.ID,
36 | "honeycombio_burn_alert",
37 | "honeycombio",
38 | map[string]string{
39 | "dataset": dataset.Name,
40 | "slo_id": slo.ID,
41 | },
42 | []string{"recipient"},
43 | map[string]interface{}{},
44 | ))
45 | }
46 | }
47 | }
48 |
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/honeycombio/column.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type ColumnGenerator struct {
11 | HoneycombService
12 | }
13 |
14 | func (g *ColumnGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | for _, dataset := range g.datasets {
21 | if dataset.Slug == environmentWideDatasetSlug {
22 | continue
23 | }
24 | columns, err := client.Columns.List(context.TODO(), dataset.Slug)
25 | if err != nil {
26 | return fmt.Errorf("unable to list Honeycomb columns for dataset %s: %v", dataset.Slug, err)
27 | }
28 |
29 | for _, column := range columns {
30 | g.Resources = append(g.Resources, terraformutils.NewResource(
31 | column.ID,
32 | fmt.Sprintf("%s_%s", dataset.Name, column.KeyName),
33 | "honeycombio_column",
34 | "honeycombio",
35 | map[string]string{
36 | "dataset": dataset.Name,
37 | "key_name": column.KeyName,
38 | },
39 | []string{"hidden", "type"},
40 | map[string]interface{}{},
41 | ))
42 | }
43 | }
44 |
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/honeycombio/dataset.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
7 | )
8 |
9 | type DatasetGenerator struct {
10 | HoneycombService
11 | }
12 |
13 | func (g *DatasetGenerator) InitResources() error {
14 | // client is not used but initializing the client populates `g.datasets`
15 | _, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | for _, dataset := range g.datasets {
21 | if dataset.Slug == environmentWideDatasetSlug {
22 | continue
23 | }
24 | g.Resources = append(g.Resources, terraformutils.NewResource(
25 | dataset.Slug,
26 | dataset.Slug,
27 | "honeycombio_dataset",
28 | "honeycombio",
29 | map[string]string{},
30 | []string{},
31 | map[string]interface{}{},
32 | ))
33 | }
34 |
35 | return nil
36 | }
37 |
--------------------------------------------------------------------------------
/providers/honeycombio/derived_column.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type DerivedColumnGenerator struct {
11 | HoneycombService
12 | }
13 |
14 | func (g *DerivedColumnGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | for _, dataset := range g.datasets {
21 | columns, err := client.DerivedColumns.List(context.TODO(), dataset.Slug)
22 | if err != nil {
23 | return fmt.Errorf("unable to list Honeycomb derived columns for dataset %q: %v", dataset.Slug, err)
24 | }
25 |
26 | for _, column := range columns {
27 | g.Resources = append(g.Resources, terraformutils.NewResource(
28 | column.ID,
29 | fmt.Sprintf("%s_%s", dataset.Name, column.Alias),
30 | "honeycombio_derived_column",
31 | "honeycombio",
32 | map[string]string{
33 | "dataset": dataset.Name,
34 | "alias": column.Alias,
35 | // TODO: is there a nicer way to format the expression?
36 | "expression": column.Expression,
37 | },
38 | []string{},
39 | map[string]interface{}{},
40 | ))
41 | }
42 | }
43 |
44 | return nil
45 | }
46 |
--------------------------------------------------------------------------------
/providers/honeycombio/query_annotation.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type QueryAnnotationGenerator struct {
11 | HoneycombService
12 | }
13 |
14 | func (g *QueryAnnotationGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | boards, err := client.Boards.List(context.TODO())
21 | if err != nil {
22 | return err
23 | }
24 |
25 | for _, board := range boards {
26 | for _, query := range board.Queries {
27 | if query.QueryAnnotationID == "" {
28 | continue
29 | }
30 |
31 | if query.Dataset == "" {
32 | // assume unset dataset is an environment-wide query
33 | query.Dataset = g.environmentWideDataset().Name
34 | }
35 | if _, exists := g.datasets[query.Dataset]; exists {
36 | g.Resources = append(g.Resources, terraformutils.NewResource(
37 | query.QueryAnnotationID,
38 | query.QueryAnnotationID,
39 | "honeycombio_query_annotation",
40 | "honeycombio",
41 | map[string]string{
42 | "query_id": query.QueryID,
43 | "dataset": query.Dataset,
44 | },
45 | []string{},
46 | map[string]interface{}{},
47 | ))
48 | }
49 | }
50 | }
51 |
52 | return nil
53 | }
54 |
--------------------------------------------------------------------------------
/providers/honeycombio/slo.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type SLOGenerator struct {
11 | HoneycombService
12 | }
13 |
14 | func (g *SLOGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | ctx := context.TODO()
21 |
22 | for _, dataset := range g.datasets {
23 | if dataset.Slug == environmentWideDatasetSlug {
24 | // environment-wide SLOs are not supported
25 | continue
26 | }
27 | slos, err := client.SLOs.List(ctx, dataset.Slug)
28 | if err != nil {
29 | return fmt.Errorf("unable to list Honeycomb SLOs for dataset %s: %v", dataset.Slug, err)
30 | }
31 |
32 | for _, slo := range slos {
33 | g.Resources = append(g.Resources, terraformutils.NewResource(
34 | slo.ID,
35 | slo.ID,
36 | "honeycombio_slo",
37 | "honeycombio",
38 | map[string]string{
39 | "dataset": dataset.Name,
40 | },
41 | []string{},
42 | map[string]interface{}{},
43 | ))
44 | }
45 | }
46 |
47 | return nil
48 | }
49 |
--------------------------------------------------------------------------------
/providers/honeycombio/trigger.go:
--------------------------------------------------------------------------------
1 | package honeycombio
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type TriggerGenerator struct {
11 | HoneycombService
12 | }
13 |
14 | func (g *TriggerGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to initialize Honeycomb client: %v", err)
18 | }
19 |
20 | for _, dataset := range g.datasets {
21 | if dataset.Slug == environmentWideDatasetSlug {
22 | // environment-wide Triggers are not supported
23 | continue
24 | }
25 | triggers, err := client.Triggers.List(context.TODO(), dataset.Slug)
26 | if err != nil {
27 | return fmt.Errorf("unable to list Honeycomb triggers for dataset %s: %v", dataset.Slug, err)
28 | }
29 |
30 | for _, trigger := range triggers {
31 | g.Resources = append(g.Resources, terraformutils.NewResource(
32 | trigger.ID,
33 | trigger.ID,
34 | "honeycombio_trigger",
35 | "honeycombio",
36 | map[string]string{
37 | "dataset": dataset.Name,
38 | },
39 | []string{},
40 | map[string]interface{}{},
41 | ))
42 | }
43 | }
44 |
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/ibm/helpers.go:
--------------------------------------------------------------------------------
1 | package ibm
2 |
3 | import (
4 | "fmt"
5 | "math/rand"
6 | "regexp"
7 | "strings"
8 | )
9 |
10 | func normalizeResourceName(s string, rand bool) string {
11 | specialChars := `-<>()*#{}[]|@_ .%'",&`
12 | for _, c := range specialChars {
13 | s = strings.ReplaceAll(s, string(c), "_")
14 | }
15 | s = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, "")
16 | s = strings.TrimSuffix(s, "`_")
17 | if rand {
18 | randString := RandStringBytes(4)
19 | return fmt.Sprintf("%s_%s", strings.ToLower(s), randString)
20 | }
21 | return strings.ToLower(s)
22 | }
23 |
24 | const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789"
25 |
26 | func RandStringBytes(n int) string {
27 | b := make([]byte, n)
28 | for i := range b {
29 | b[i] = letterBytes[rand.Intn(len(letterBytes))]
30 | }
31 | return string(b)
32 | }
33 | func getRandom(names map[string]struct{}, name string, random bool) (map[string]struct{}, bool) {
34 | if _, ok := names[name]; ok {
35 | random = true
36 | }
37 | names[name] = struct{}{}
38 | return names, random
39 | }
40 |
--------------------------------------------------------------------------------
/providers/ibm/ibm_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package ibm
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | type IBMService struct { //nolint
22 | terraformutils.Service
23 | }
24 |
--------------------------------------------------------------------------------
/providers/ionoscloud/backup_unit.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type BackupUnitGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *BackupUnitGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_backup_unit"
19 |
20 | backupUnitResponse, _, err := cloudAPIClient.BackupUnitsApi.BackupunitsGet(context.TODO()).Depth(1).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if backupUnitResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing backup units but received 'nil' instead.")
26 | return nil
27 | }
28 | backupUnits := *backupUnitResponse.Items
29 | for _, backupUnit := range backupUnits {
30 | if backupUnit.Properties == nil || backupUnit.Properties.Name == nil {
31 | log.Printf(
32 | "[WARNING] 'nil' values in the response for backup unit with ID %v, skipping this resource.\n",
33 | *backupUnit.Id)
34 | continue
35 | }
36 | g.Resources = append(g.Resources, terraformutils.NewResource(
37 | *backupUnit.Id,
38 | *backupUnit.Properties.Name+"-"+*backupUnit.Id,
39 | resourceType,
40 | helpers.Ionos,
41 | map[string]string{},
42 | []string{},
43 | map[string]interface{}{}))
44 | }
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/ionoscloud/certificate.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type CertificateGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *CertificateGenerator) InitResources() error {
16 | client := g.generateClient()
17 | certManagerAPIClient := client.CertificateManagerAPIClient
18 | resourceType := "ionoscloud_certificate"
19 |
20 | response, _, err := certManagerAPIClient.CertificatesApi.CertificatesGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if response.Items == nil {
25 | log.Printf("[WARNING] expected a response containing certificates but received 'nil' instead.")
26 | return nil
27 | }
28 | certificates := *response.Items
29 | for _, certificate := range certificates {
30 | if certificate.Properties == nil || certificate.Properties.Name == nil {
31 | log.Printf("[WARNING] 'nil' values in the response for the certificate with ID %v, skipping this resource.", *certificate.Id)
32 | continue
33 | }
34 | g.Resources = append(g.Resources, terraformutils.NewResource(
35 | *certificate.Id,
36 | *certificate.Properties.Name+"-"+*certificate.Id,
37 | resourceType,
38 | helpers.Ionos,
39 | map[string]string{},
40 | []string{},
41 | map[string]interface{}{}))
42 | }
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/ionoscloud/container_registry.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type ContainerRegistryGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *ContainerRegistryGenerator) InitResources() error {
16 | client := g.generateClient()
17 | containerRegistryAPIClient := client.ContainerRegistryAPIClient
18 | resourceType := "ionoscloud_container_registry"
19 |
20 | response, _, err := containerRegistryAPIClient.RegistriesApi.RegistriesGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if response.Items == nil {
25 | log.Printf("[WARNING] expected a response containing registries but received 'nil' instead.")
26 | return nil
27 | }
28 | registries := *response.Items
29 | for _, registry := range registries {
30 | if registry.Properties == nil || registry.Properties.Name == nil {
31 | log.Printf("[WARNING] 'nil' values in the response for the registry with ID %v, skipping this resource.", *registry.Id)
32 | continue
33 | }
34 | g.Resources = append(g.Resources, terraformutils.NewResource(
35 | *registry.Id,
36 | *registry.Properties.Name+"-"+*registry.Id,
37 | resourceType,
38 | helpers.Ionos,
39 | map[string]string{},
40 | []string{},
41 | map[string]interface{}{}))
42 | }
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/ionoscloud/datacenter.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "log"
5 |
6 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | ionoscloud "github.com/ionos-cloud/sdk-go/v6"
9 | )
10 |
11 | type DatacenterGenerator struct {
12 | Service
13 | }
14 |
15 | func (g DatacenterGenerator) createResources(datacentersList []ionoscloud.Datacenter) []terraformutils.Resource {
16 | var resources []terraformutils.Resource
17 | for _, datacenter := range datacentersList {
18 | if datacenter.Properties == nil || datacenter.Properties.Name == nil {
19 | log.Printf("[WARNING] 'nil' values in the response for Datacenter with ID %v, skipping this resource.\n", *datacenter.Id)
20 | continue
21 | }
22 | resources = append(resources, terraformutils.NewResource(
23 | *datacenter.Id,
24 | *datacenter.Properties.Name+"-"+*datacenter.Id,
25 | "ionoscloud_datacenter",
26 | helpers.Ionos,
27 | map[string]string{},
28 | []string{},
29 | map[string]interface{}{}))
30 | }
31 | return resources
32 | }
33 |
34 | func (g *DatacenterGenerator) InitResources() error {
35 | client := g.generateClient()
36 | cloudAPIClient := client.CloudAPIClient
37 | output, err := helpers.GetAllDatacenters(*cloudAPIClient)
38 | if err != nil {
39 | return err
40 | }
41 | g.Resources = g.createResources(output)
42 | return nil
43 | }
44 |
--------------------------------------------------------------------------------
/providers/ionoscloud/dataplatform_cluster.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type DataPlatformClusterGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *DataPlatformClusterGenerator) InitResources() error {
16 | client := g.generateClient()
17 | dataPlatformClient := client.DataPlatformAPIClient
18 | resourceType := "ionoscloud_dataplatform_cluster"
19 |
20 | response, _, err := dataPlatformClient.DataPlatformClusterApi.ClustersGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if response.Items == nil {
25 | log.Printf("[WARNING] expected a response containing data platform clusters, but received 'nil' instead.")
26 | return nil
27 | }
28 | clusters := *response.Items
29 | for _, cluster := range clusters {
30 | if cluster.Properties == nil || cluster.Properties.Name == nil {
31 | log.Printf("[WARNING] 'nil' values in the response for data platform cluster with ID %v, skipping this resource.", *cluster.Id)
32 | continue
33 | }
34 | g.Resources = append(g.Resources, terraformutils.NewResource(
35 | *cluster.Id,
36 | *cluster.Properties.Name+"-"+*cluster.Id,
37 | resourceType,
38 | helpers.Ionos,
39 | map[string]string{},
40 | []string{},
41 | map[string]interface{}{}))
42 | }
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/ionoscloud/dbaas_mongo_cluster.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type DBaaSMongoClusterGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *DBaaSMongoClusterGenerator) InitResources() error {
16 | client := g.generateClient()
17 | dbaasMongoClient := client.DBaaSMongoAPIClient
18 | resourceType := "ionoscloud_mongo_cluster"
19 |
20 | response, _, err := dbaasMongoClient.ClustersApi.ClustersGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if response.Items == nil {
25 | log.Printf("[WARNING] expected a response containing Mongo DB clusters but received 'nil' instead")
26 | }
27 | clusters := *response.Items
28 | for _, cluster := range clusters {
29 | if cluster.Properties == nil || cluster.Properties.DisplayName == nil {
30 | log.Printf("[WARNING] 'nil' values in the response for Mongo DB cluster with ID: %v, skipping search for this resource", *cluster.Id)
31 | continue
32 | }
33 | g.Resources = append(g.Resources, terraformutils.NewResource(
34 | *cluster.Id,
35 | *cluster.Properties.DisplayName+"-"+*cluster.Id,
36 | resourceType,
37 | helpers.Ionos,
38 | map[string]string{},
39 | []string{},
40 | map[string]interface{}{}))
41 | }
42 | return nil
43 | }
44 |
--------------------------------------------------------------------------------
/providers/ionoscloud/dns_zone.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type DNSZoneGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *DNSZoneGenerator) InitResources() error {
16 | client := g.generateClient()
17 | dnsAPIClient := client.DNSAPIClient
18 | resourceType := "ionoscloud_dns_zone"
19 |
20 | response, _, err := dnsAPIClient.ZonesApi.ZonesGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if response.Items == nil {
25 | log.Printf("[WARNING] expected a response containing DNS Zones, but received 'nil' instead")
26 | return nil
27 | }
28 | zones := *response.Items
29 | for _, zone := range zones {
30 | if zone.Properties == nil || zone.Properties.ZoneName == nil {
31 | log.Printf("[WARNING] 'nil' values in the response for the DNS Zone with ID: %v, skipping this resource", *zone.Id)
32 | continue
33 | }
34 | g.Resources = append(g.Resources, terraformutils.NewResource(
35 | *zone.Id,
36 | *zone.Properties.ZoneName+"-"+*zone.Id,
37 | resourceType,
38 | helpers.Ionos,
39 | map[string]string{},
40 | []string{},
41 | map[string]interface{}{}))
42 | }
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/ionoscloud/group.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type GroupGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *GroupGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_group"
19 |
20 | groupResponse, _, err := cloudAPIClient.UserManagementApi.UmGroupsGet(context.TODO()).Depth(1).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if groupResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing groups but received 'nil' instead.")
26 | return nil
27 | }
28 | groups := *groupResponse.Items
29 | for _, group := range groups {
30 | if group.Properties == nil || group.Properties.Name == nil {
31 | log.Printf(
32 | "[WARNING] 'nil' values in the response for group with ID %v, skipping this resource.\n",
33 | *group.Id)
34 | continue
35 | }
36 | g.Resources = append(g.Resources, terraformutils.NewResource(
37 | *group.Id,
38 | *group.Properties.Name+"-"+*group.Id,
39 | resourceType,
40 | helpers.Ionos,
41 | map[string]string{},
42 | []string{},
43 | map[string]interface{}{}))
44 | }
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/ionoscloud/helpers/constants.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import "time"
4 |
5 | // Provider Constants
6 | const (
7 | ProviderName = "ionoscloud"
8 | )
9 |
10 | // Config Constants
11 | const (
12 | IonosDebug = "IONOS_DEBUG"
13 | Ionos = "ionoscloud"
14 | DcID = "datacenter_id"
15 | ClusterID = "cluster_id"
16 | ServerID = "server_id"
17 | NicID = "nic_id"
18 | K8sClusterID = "k8s_cluster_id"
19 | UserID = "user_id"
20 | GroupID = "group_id"
21 | ResourceID = "resource_id"
22 | ZoneID = "zone_id"
23 |
24 | UsernameArg = "username"
25 | NameArg = "name"
26 | PasswordArg = "password"
27 | TokenArg = "token"
28 | URLArg = "url"
29 | // MaxRetries - number of retries in case of rate-limit
30 | MaxRetries = 999
31 |
32 | // MaxWaitTime - waits 4 seconds before retry in case of rate limit
33 | MaxWaitTime = 4 * time.Second
34 | )
35 |
36 | const (
37 | CredentialsError = "set IONOS_USERNAME and IONOS_PASSWORD or IONOS_TOKEN env var"
38 | )
39 |
--------------------------------------------------------------------------------
/providers/ionoscloud/helpers/helper_dependencies_list.go:
--------------------------------------------------------------------------------
1 | package helpers
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | ionoscloud "github.com/ionos-cloud/sdk-go/v6"
8 | )
9 |
10 | func GetAllDatacenters(client ionoscloud.APIClient) ([]ionoscloud.Datacenter, error) {
11 | datacenters, _, err := client.DataCentersApi.DatacentersGet(context.TODO()).Depth(1).Execute()
12 | if err != nil {
13 | return nil, err
14 | }
15 | if datacenters.Items == nil {
16 | log.Printf("[WARNING] expected a response containing datacenters but received 'nil' instead.")
17 | return nil, nil
18 | }
19 | return *datacenters.Items, nil
20 | }
21 |
--------------------------------------------------------------------------------
/providers/ionoscloud/ip_block.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type IPBlockGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *IPBlockGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_ipblock"
19 |
20 | ipBlockResponse, _, err := cloudAPIClient.IPBlocksApi.IpblocksGet(context.TODO()).Depth(1).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if ipBlockResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing IP blocks but received 'nil' instead.")
26 | return nil
27 | }
28 | ipBlocks := *ipBlockResponse.Items
29 | for _, ipBlock := range ipBlocks {
30 | if ipBlock.Properties == nil || ipBlock.Properties.Name == nil {
31 | log.Printf(
32 | "[WARNING] 'nil' values in the response for IP block with ID %v, skipping this resource.\n",
33 | *ipBlock.Id)
34 | continue
35 | }
36 | g.Resources = append(g.Resources, terraformutils.NewResource(
37 | *ipBlock.Id,
38 | *ipBlock.Properties.Name+"-"+*ipBlock.Id,
39 | resourceType,
40 | helpers.Ionos,
41 | map[string]string{},
42 | []string{},
43 | map[string]interface{}{}))
44 | }
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/ionoscloud/kubernetes_cluster.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type KubernetesClusterGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *KubernetesClusterGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_k8s_cluster"
19 |
20 | kubernetesClusterResponse, _, err := cloudAPIClient.KubernetesApi.K8sGet(context.TODO()).Depth(1).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if kubernetesClusterResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing k8s clusters but received 'nil' instead.")
26 | return nil
27 | }
28 | kubernetesClusters := *kubernetesClusterResponse.Items
29 | for _, kubernetesCluster := range kubernetesClusters {
30 | if kubernetesCluster.Properties == nil || kubernetesCluster.Properties.Name == nil {
31 | log.Printf(
32 | "[WARNING] 'nil' values in the response for k8s cluster with ID %v, skipping this resource.\n",
33 | *kubernetesCluster.Id)
34 | continue
35 | }
36 | g.Resources = append(g.Resources, terraformutils.NewResource(
37 | *kubernetesCluster.Id,
38 | *kubernetesCluster.Properties.Name+"-"+*kubernetesCluster.Id,
39 | resourceType,
40 | helpers.Ionos,
41 | map[string]string{},
42 | []string{},
43 | map[string]interface{}{}))
44 | }
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/ionoscloud/logging_pipeline.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type LoggingPipelineGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *LoggingPipelineGenerator) InitResources() error {
16 | client := g.generateClient()
17 | loggingAPIClient := client.LoggingAPIClient
18 | resourceType := "ionoscloud_logging_pipeline"
19 |
20 | response, _, err := loggingAPIClient.PipelinesApi.PipelinesGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if response.Items == nil {
25 | log.Printf("[WARNING] expected a response containing pipelines, but received 'nil' instead")
26 | return nil
27 | }
28 | pipelines := *response.Items
29 | for _, pipeline := range pipelines {
30 | if pipeline.Properties == nil || pipeline.Properties.Name == nil {
31 | log.Printf("[WARNING] 'nil' values in the response for the pipeline with ID: %v, skipping this resource", *pipeline.Id)
32 | continue
33 | }
34 | g.Resources = append(g.Resources, terraformutils.NewResource(
35 | *pipeline.Id,
36 | *pipeline.Properties.Name+"-"+*pipeline.Id,
37 | resourceType,
38 | helpers.Ionos,
39 | map[string]string{},
40 | []string{},
41 | map[string]interface{}{}))
42 | }
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/ionoscloud/private_crossconnect.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type PrivateCrossConnectGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *PrivateCrossConnectGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_private_crossconnect"
19 |
20 | pccsResponse, _, err := cloudAPIClient.PrivateCrossConnectsApi.PccsGet(context.TODO()).Depth(1).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if pccsResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing PCCs but received 'nil' instead.\n")
26 | return nil
27 | }
28 | pccs := *pccsResponse.Items
29 | for _, pcc := range pccs {
30 | if pcc.Properties == nil || pcc.Properties.Name == nil {
31 | log.Printf("[WARNING] 'nil' values in the response for PCC with ID %v, skipping this resource.\n", *pcc.Id)
32 | continue
33 | }
34 | g.Resources = append(g.Resources, terraformutils.NewResource(
35 | *pcc.Id,
36 | *pcc.Properties.Name+"-"+*pcc.Id,
37 | resourceType,
38 | helpers.Ionos,
39 | map[string]string{},
40 | []string{},
41 | map[string]interface{}{}))
42 | }
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/ionoscloud/s3_key.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type S3KeyGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *S3KeyGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_s3_key"
19 |
20 | usersResponse, _, err := cloudAPIClient.UserManagementApi.UmUsersGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if usersResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing users but received 'nil' instead")
26 | return nil
27 | }
28 | for _, user := range *usersResponse.Items {
29 | s3KeysResponse, _, err := cloudAPIClient.UserS3KeysApi.UmUsersS3keysGet(context.TODO(), *user.Id).Depth(1).Execute()
30 | if err != nil {
31 | return err
32 | }
33 | if s3KeysResponse.Items == nil {
34 | log.Printf("[WARNING] expected a response containing S3 keys but received 'nil' instead, skipping search for user with ID: %v.\n",
35 | *user.Id)
36 | continue
37 | }
38 | for _, s3Key := range *s3KeysResponse.Items {
39 | g.Resources = append(g.Resources, terraformutils.NewResource(
40 | *s3Key.Id,
41 | *s3Key.Id,
42 | resourceType,
43 | helpers.Ionos,
44 | map[string]string{helpers.UserID: *user.Id},
45 | []string{},
46 | map[string]interface{}{}))
47 | }
48 | }
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/ionoscloud/share.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type ShareGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *ShareGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_share"
19 |
20 | groups, _, err := cloudAPIClient.UserManagementApi.UmGroupsGet(context.TODO()).Depth(1).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if groups.Items == nil {
25 | log.Printf("[WARNING] expected a response containing groups but received 'nil' instead.")
26 | return nil
27 | }
28 | for _, group := range *groups.Items {
29 | shares, _, err := cloudAPIClient.UserManagementApi.UmGroupsSharesGet(context.TODO(), *group.Id).Execute()
30 | if err != nil {
31 | return err
32 | }
33 | if shares.Items == nil {
34 | log.Printf("[WARNING] expected a response containing shares but received 'nil' instead, skipping search for group with ID: %s", *group.Id)
35 | continue
36 | }
37 | for _, share := range *shares.Items {
38 | g.Resources = append(g.Resources, terraformutils.NewResource(
39 | *share.Id,
40 | *share.Id,
41 | resourceType,
42 | helpers.Ionos,
43 | map[string]string{helpers.GroupID: *group.Id, helpers.ResourceID: *share.Id},
44 | []string{},
45 | map[string]interface{}{}))
46 | }
47 | }
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/ionoscloud/target_group.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type TargetGroupGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *TargetGroupGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_target_group"
19 |
20 | targetGroupResponse, _, err := cloudAPIClient.TargetGroupsApi.TargetgroupsGet(context.TODO()).Depth(1).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if targetGroupResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing target groups but received 'nil' instead.")
26 | return nil
27 | }
28 | targetGroups := *targetGroupResponse.Items
29 | for _, targetGroup := range targetGroups {
30 | if targetGroup.Properties == nil || targetGroup.Properties.Name == nil {
31 | log.Printf(
32 | "[WARNING] 'nil' values in the response for target group with ID %v, skipping this resource.\n",
33 | *targetGroup.Id)
34 | continue
35 | }
36 | g.Resources = append(g.Resources, terraformutils.NewResource(
37 | *targetGroup.Id,
38 | *targetGroup.Properties.Name+"-"+*targetGroup.Id,
39 | resourceType,
40 | helpers.Ionos,
41 | map[string]string{},
42 | []string{},
43 | map[string]interface{}{}))
44 | }
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/ionoscloud/user.go:
--------------------------------------------------------------------------------
1 | package ionoscloud
2 |
3 | import (
4 | "context"
5 | "log"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers"
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | )
10 |
11 | type UserGenerator struct {
12 | Service
13 | }
14 |
15 | func (g *UserGenerator) InitResources() error {
16 | client := g.generateClient()
17 | cloudAPIClient := client.CloudAPIClient
18 | resourceType := "ionoscloud_user"
19 |
20 | usersResponse, _, err := cloudAPIClient.UserManagementApi.UmUsersGet(context.TODO()).Execute()
21 | if err != nil {
22 | return err
23 | }
24 | if usersResponse.Items == nil {
25 | log.Printf("[WARNING] expected a response containing users but received 'nil' instead")
26 | return nil
27 | }
28 | for _, user := range *usersResponse.Items {
29 | g.Resources = append(g.Resources, terraformutils.NewResource(
30 | *user.Id,
31 | *user.Id,
32 | resourceType,
33 | helpers.Ionos,
34 | map[string]string{},
35 | []string{},
36 | map[string]interface{}{}))
37 | }
38 | return nil
39 | }
40 |
--------------------------------------------------------------------------------
/providers/keycloak/keycloak_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package keycloak
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | type KeycloakService struct { //nolint
22 | terraformutils.Service
23 | }
24 |
--------------------------------------------------------------------------------
/providers/keycloak/role.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package keycloak
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | "github.com/mrparkers/terraform-provider-keycloak/keycloak"
20 | )
21 |
22 | func (g RealmGenerator) createRoleResources(roles []*keycloak.Role) []terraformutils.Resource {
23 | var resources []terraformutils.Resource
24 | for _, role := range roles {
25 | resources = append(resources, terraformutils.NewResource(
26 | role.Id,
27 | "role_"+normalizeResourceName(role.RealmId)+normalizeResourceName(role.ContainerId)+"_"+normalizeResourceName(role.Name),
28 | "keycloak_role",
29 | "keycloak",
30 | map[string]string{
31 | "realm_id": role.RealmId,
32 | },
33 | []string{},
34 | map[string]interface{}{},
35 | ))
36 | }
37 | return resources
38 | }
39 |
--------------------------------------------------------------------------------
/providers/keycloak/user.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package keycloak
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | "github.com/mrparkers/terraform-provider-keycloak/keycloak"
20 | )
21 |
22 | func (g RealmGenerator) createUserResources(users []*keycloak.User) []terraformutils.Resource {
23 | var resources []terraformutils.Resource
24 | for _, user := range users {
25 | resources = append(resources, terraformutils.NewResource(
26 | user.Id,
27 | "user_"+normalizeResourceName(user.RealmId)+"_"+normalizeResourceName(user.Username),
28 | "keycloak_user",
29 | "keycloak",
30 | map[string]string{
31 | "realm_id": user.RealmId,
32 | },
33 | []string{},
34 | map[string]interface{}{},
35 | ))
36 | }
37 | return resources
38 | }
39 |
--------------------------------------------------------------------------------
/providers/kubernetes/kubernetes_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package kubernetes
16 |
17 | import "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 |
19 | type KubernetesService struct { //nolint
20 | terraformutils.Service
21 | }
22 |
--------------------------------------------------------------------------------
/providers/kubernetes/utils.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package kubernetes
16 |
17 | import (
18 | "strings"
19 |
20 | "github.com/iancoleman/strcase"
21 | )
22 |
23 | func extractClientSetFuncGroupName(group, version string) string {
24 | v := strings.Title(version)
25 | if len(group) > 0 {
26 | return strings.Title(strings.Split(group, ".")[0]) + v
27 | }
28 | return "Core" + v
29 | }
30 |
31 | func extractClientSetFuncTypeName(kind string) string {
32 | switch string(kind[len(kind)-1]) {
33 | case "s":
34 | return kind + "es"
35 | case "y":
36 | return strings.TrimSuffix(kind, "y") + "ies"
37 | }
38 | return kind + "s"
39 | }
40 |
41 | func extractTfResourceName(kind string) string {
42 | return "kubernetes_" + strcase.ToSnake(kind)
43 | }
44 |
--------------------------------------------------------------------------------
/providers/launchdarkly/launchdarkly_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package launchdarkly
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | type LaunchDarklyService struct { //nolint
22 | terraformutils.Service
23 | }
24 |
--------------------------------------------------------------------------------
/providers/linode/image.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package linode
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/linode/linodego"
22 | )
23 |
24 | type ImageGenerator struct {
25 | LinodeService
26 | }
27 |
28 | func (g ImageGenerator) createResources(imageList []linodego.Image) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, image := range imageList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | image.ID,
33 | image.ID,
34 | "linode_image",
35 | "linode",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *ImageGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.ListImages(context.Background(), nil)
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/linode/instance.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package linode
16 |
17 | import (
18 | "context"
19 | "strconv"
20 |
21 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
22 | "github.com/linode/linodego"
23 | )
24 |
25 | type InstanceGenerator struct {
26 | LinodeService
27 | }
28 |
29 | func (g InstanceGenerator) createResources(instanceList []linodego.Instance) []terraformutils.Resource {
30 | var resources []terraformutils.Resource
31 | for _, instance := range instanceList {
32 | resources = append(resources, terraformutils.NewSimpleResource(
33 | strconv.Itoa(instance.ID),
34 | strconv.Itoa(instance.ID),
35 | "linode_instance",
36 | "linode",
37 | []string{}))
38 | }
39 | return resources
40 | }
41 |
42 | func (g *InstanceGenerator) InitResources() error {
43 | client := g.generateClient()
44 | output, err := client.ListInstances(context.Background(), nil)
45 | if err != nil {
46 | return err
47 | }
48 | g.Resources = g.createResources(output)
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/linode/linode_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package linode
16 |
17 | import (
18 | "net/http"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/linode/linodego"
22 | "golang.org/x/oauth2"
23 | )
24 |
25 | type LinodeService struct { //nolint
26 | terraformutils.Service
27 | }
28 |
29 | func (s *LinodeService) generateClient() linodego.Client {
30 | tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: s.Args["token"].(string)})
31 | oauth2Client := &http.Client{
32 | Transport: &oauth2.Transport{
33 | Source: tokenSource,
34 | },
35 | }
36 | linodeClient := linodego.NewClient(oauth2Client)
37 | linodeClient.SetDebug(s.Verbose)
38 | return linodeClient
39 | }
40 |
--------------------------------------------------------------------------------
/providers/linode/rdns.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package linode
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/linode/linodego"
22 | )
23 |
24 | type RDNSGenerator struct {
25 | LinodeService
26 | }
27 |
28 | func (g RDNSGenerator) createResources(instanceIPList []linodego.InstanceIP) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, instanceIP := range instanceIPList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | instanceIP.Address,
33 | instanceIP.Address,
34 | "linode_rdns",
35 | "linode",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *RDNSGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.ListIPAddresses(context.Background(), nil)
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/linode/sshkey.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package linode
16 |
17 | import (
18 | "context"
19 | "strconv"
20 |
21 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
22 | "github.com/linode/linodego"
23 | )
24 |
25 | type SSHKeyGenerator struct {
26 | LinodeService
27 | }
28 |
29 | func (g SSHKeyGenerator) createResources(keyList []linodego.SSHKey) []terraformutils.Resource {
30 | var resources []terraformutils.Resource
31 | for _, key := range keyList {
32 | resources = append(resources, terraformutils.NewSimpleResource(
33 | strconv.Itoa(key.ID),
34 | strconv.Itoa(key.ID),
35 | "linode_sshkey",
36 | "linode",
37 | []string{}))
38 | }
39 | return resources
40 | }
41 |
42 | func (g *SSHKeyGenerator) InitResources() error {
43 | client := g.generateClient()
44 | output, err := client.ListSSHKeys(context.Background(), nil)
45 | if err != nil {
46 | return err
47 | }
48 | g.Resources = g.createResources(output)
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/linode/token.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package linode
16 |
17 | import (
18 | "context"
19 | "strconv"
20 |
21 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
22 | "github.com/linode/linodego"
23 | )
24 |
25 | type TokenGenerator struct {
26 | LinodeService
27 | }
28 |
29 | func (g TokenGenerator) createResources(tokenList []linodego.Token) []terraformutils.Resource {
30 | var resources []terraformutils.Resource
31 | for _, token := range tokenList {
32 | resources = append(resources, terraformutils.NewSimpleResource(
33 | strconv.Itoa(token.ID),
34 | strconv.Itoa(token.ID),
35 | "linode_token",
36 | "linode",
37 | []string{}))
38 | }
39 | return resources
40 | }
41 |
42 | func (g *TokenGenerator) InitResources() error {
43 | client := g.generateClient()
44 | output, err := client.ListTokens(context.Background(), nil)
45 | if err != nil {
46 | return err
47 | }
48 | g.Resources = g.createResources(output)
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/linode/volume.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package linode
16 |
17 | import (
18 | "context"
19 | "strconv"
20 |
21 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
22 | "github.com/linode/linodego"
23 | )
24 |
25 | type VolumeGenerator struct {
26 | LinodeService
27 | }
28 |
29 | func (g VolumeGenerator) createResources(volumeList []linodego.Volume) []terraformutils.Resource {
30 | var resources []terraformutils.Resource
31 | for _, volume := range volumeList {
32 | resources = append(resources, terraformutils.NewSimpleResource(
33 | strconv.Itoa(volume.ID),
34 | strconv.Itoa(volume.ID),
35 | "linode_volume",
36 | "linode",
37 | []string{}))
38 | }
39 | return resources
40 | }
41 |
42 | func (g *VolumeGenerator) InitResources() error {
43 | client := g.generateClient()
44 | output, err := client.ListVolumes(context.Background(), nil)
45 | if err != nil {
46 | return err
47 | }
48 | g.Resources = g.createResources(output)
49 | return nil
50 | }
51 |
--------------------------------------------------------------------------------
/providers/logzio/logzio_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package logzio
16 |
17 | import "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 |
19 | type LogzioService struct { //nolint
20 | terraformutils.Service
21 | }
22 |
--------------------------------------------------------------------------------
/providers/mackerel/mackerel_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2021 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package mackerel
16 |
17 | import "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 |
19 | type MackerelService struct { // nolint
20 | terraformutils.Service
21 | }
22 |
--------------------------------------------------------------------------------
/providers/mikrotik/mikrotik_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | package mikrotik
15 |
16 | import (
17 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 | "github.com/ddelnano/terraform-provider-mikrotik/client"
19 | )
20 |
21 | type MikrotikService struct { //nolint
22 | terraformutils.Service
23 | }
24 |
25 | func (m *MikrotikService) generateClient() client.Mikrotik {
26 | return client.NewClient(
27 | client.GetConfigFromEnv(),
28 | )
29 | }
30 |
--------------------------------------------------------------------------------
/providers/myrasec/myrasec_service.go:
--------------------------------------------------------------------------------
1 | package myrasec
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "os"
7 |
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | mgo "github.com/Myra-Security-GmbH/myrasec-go/v2"
10 | )
11 |
12 | // MyrasecService ...
13 | type MyrasecService struct {
14 | terraformutils.Service
15 | }
16 |
17 | // initializeAPI ...
18 | func (s *MyrasecService) initializeAPI() (*mgo.API, error) {
19 | apiKey := os.Getenv("MYRASEC_API_KEY")
20 | apiSecret := os.Getenv("MYRASEC_API_SECRET")
21 | apiURL, urlPresent := os.LookupEnv("MYRASEC_API_BASE_URL")
22 |
23 | if apiKey == "" || apiSecret == "" {
24 | err := errors.New("missing API credentials")
25 | fmt.Fprintln(os.Stderr, err)
26 | return nil, err
27 | }
28 |
29 | api, err := mgo.New(apiKey, apiSecret)
30 | if urlPresent {
31 | api.BaseURL = apiURL
32 | }
33 | api.EnableCaching()
34 | api.SetCachingTTL(3600)
35 |
36 | return api, err
37 | }
38 |
--------------------------------------------------------------------------------
/providers/myrasec/settings.go:
--------------------------------------------------------------------------------
1 | package myrasec
2 |
3 | import (
4 | "fmt"
5 | "strconv"
6 | "sync"
7 |
8 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
9 | mgo "github.com/Myra-Security-GmbH/myrasec-go/v2"
10 | )
11 |
12 | //
13 | // SettingGenerator
14 | //
15 | type SettingsGenerator struct {
16 | MyrasecService
17 | }
18 |
19 | //
20 | // createSettingResources
21 | //
22 | func (g *SettingsGenerator) createSettingResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {
23 | defer wg.Done()
24 |
25 | params := map[string]string{}
26 |
27 | s, err := api.ListSettings(domainId, vhost.Label, params)
28 | if err != nil {
29 | return err
30 | }
31 |
32 | r := terraformutils.NewResource(
33 | strconv.Itoa(vhost.ID),
34 | fmt.Sprintf("%s_%d", vhost.Label, vhost.ID),
35 | "myrasec_settings",
36 | "myrasec",
37 | map[string]string{
38 | "subdomain_name": vhost.Label,
39 | "only_https": strconv.FormatBool(s.OnlyHTTPS),
40 | },
41 | []string{},
42 | map[string]interface{}{},
43 | )
44 | g.Resources = append(g.Resources, r)
45 | return nil
46 | }
47 |
48 | //
49 | // InitResources
50 | //
51 | func (g *SettingsGenerator) InitResources() error {
52 | wg := sync.WaitGroup{}
53 |
54 | api, err := g.initializeAPI()
55 | if err != nil {
56 | return nil
57 | }
58 |
59 | funcs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{
60 | g.createSettingResources,
61 | }
62 |
63 | err = createResourcesPerSubDomain(api, funcs, &wg, true)
64 | if err != nil {
65 | return nil
66 | }
67 |
68 | wg.Wait()
69 |
70 | return nil
71 | }
72 |
--------------------------------------------------------------------------------
/providers/newrelic/helpers.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package newrelic
16 |
17 | import (
18 | "regexp"
19 | "strings"
20 | )
21 |
22 | func removeDuplicate(s string) string {
23 | if len(s) < 2 {
24 | return s
25 | }
26 |
27 | src := []byte(s)
28 | dest := make([]byte, len(src))
29 | dest[0] = src[0]
30 |
31 | j := 0
32 | for i := 1; i < len(s); i++ {
33 | if dest[j] != src[i] {
34 | j++
35 | dest[j] = src[i]
36 | }
37 | }
38 |
39 | return string(dest[:j+1])
40 | }
41 |
42 | // Making resource's name less ugly
43 | func normalizeResourceName(s string) string {
44 | specialChars := `<>()*#{}[]|@_ .%'",&`
45 | for _, c := range specialChars {
46 | s = strings.ReplaceAll(s, string(c), "-")
47 | }
48 |
49 | s = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, "")
50 | s = strings.TrimSuffix(s, "-")
51 | s = removeDuplicate(s)
52 |
53 | return strings.ToLower(s)
54 | }
55 |
--------------------------------------------------------------------------------
/providers/newrelic/newrelic_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package newrelic
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | newrelic "github.com/newrelic/newrelic-client-go/newrelic"
20 | )
21 |
22 | type NewRelicService struct { //nolint
23 | terraformutils.Service
24 | }
25 |
26 | func (s *NewRelicService) Client() (*newrelic.NewRelic, error) {
27 | return newrelic.New(newrelic.ConfigPersonalAPIKey(s.GetArgs()["apiKey"].(string)))
28 | }
29 |
--------------------------------------------------------------------------------
/providers/ns1/ns1_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package ns1
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | )
20 |
21 | type Ns1Service struct { //nolint
22 | terraformutils.Service
23 | }
24 |
--------------------------------------------------------------------------------
/providers/ns1/team.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package ns1
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | ns1 "gopkg.in/ns1/ns1-go.v2/rest"
20 | "net/http"
21 | "time"
22 | )
23 |
24 | type TeamGenerator struct {
25 | Ns1Service
26 | }
27 |
28 | func (g *TeamGenerator) createTeamResources(client *ns1.Client) error {
29 | teams, _, err := client.Teams.List()
30 | if err != nil {
31 | return err
32 | }
33 |
34 | for _, t := range teams {
35 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
36 | t.ID,
37 | t.ID,
38 | "ns1_team",
39 | "ns1",
40 | []string{}))
41 | }
42 |
43 | return nil
44 | }
45 |
46 | func (g *TeamGenerator) InitResources() error {
47 | httpClient := &http.Client{Timeout: time.Second * 10}
48 | client := ns1.NewClient(httpClient, ns1.SetAPIKey(g.Args["api_key"].(string)))
49 |
50 | if err := g.createTeamResources(client); err != nil {
51 | return err
52 | }
53 |
54 | return nil
55 | }
56 |
--------------------------------------------------------------------------------
/providers/octopusdeploy/octopusdeploy_service.go:
--------------------------------------------------------------------------------
1 | package octopusdeploy
2 |
3 | import (
4 | "errors"
5 | "net/http"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | "github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy"
9 | )
10 |
11 | type OctopusDeployService struct { //nolint
12 | terraformutils.Service
13 | }
14 |
15 | func (s *OctopusDeployService) Client() (*octopusdeploy.Client, error) {
16 | octopusURL := s.Args["address"].(string)
17 | octopusAPIKey := s.Args["api_key"].(string)
18 |
19 | if octopusURL == "" || octopusAPIKey == "" {
20 | err := errors.New("Please make sure to set the env variables 'OCTOPUS_CLI_SERVER' and 'OCTOPUS_CLI_API_KEY'")
21 | return nil, err
22 | }
23 |
24 | httpClient := http.Client{}
25 | client := octopusdeploy.NewClient(&httpClient, octopusURL, octopusAPIKey)
26 |
27 | return client, nil
28 | }
29 |
--------------------------------------------------------------------------------
/providers/opal/group.go:
--------------------------------------------------------------------------------
1 | package opal
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type GroupGenerator struct {
11 | OpalService
12 | }
13 |
14 | func (g *GroupGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to list opal groups: %v", err)
18 | }
19 |
20 | groups, _, err := client.GroupsApi.GetGroups(context.TODO()).Execute()
21 | if err != nil {
22 | return fmt.Errorf("unable to list opal groups: %v", err)
23 | }
24 |
25 | countByName := make(map[string]int)
26 |
27 | for {
28 | for _, group := range groups.Results {
29 | name := normalizeResourceName(*group.Name)
30 | if count, ok := countByName[name]; ok {
31 | countByName[name] = count + 1
32 | name = normalizeResourceName(fmt.Sprintf("%s_%d", *group.Name, count+1))
33 | } else {
34 | countByName[name] = 1
35 | }
36 |
37 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
38 | group.GroupId,
39 | name,
40 | "opal_group",
41 | "opal",
42 | []string{},
43 | ))
44 | }
45 |
46 | if !groups.HasNext() || groups.Next.Get() == nil {
47 | break
48 | }
49 |
50 | groups, _, err = client.GroupsApi.GetGroups(context.TODO()).Cursor(*groups.Next.Get()).Execute()
51 | if err != nil {
52 | return fmt.Errorf("unable to list opal groups: %v", err)
53 | }
54 | }
55 |
56 | return nil
57 | }
58 |
--------------------------------------------------------------------------------
/providers/opal/message_channel.go:
--------------------------------------------------------------------------------
1 | package opal
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type MessageChannelGenerator struct {
11 | OpalService
12 | }
13 |
14 | func (g *MessageChannelGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to list opal message channels: %v", err)
18 | }
19 |
20 | messageChannels, _, err := client.MessageChannelsApi.GetMessageChannels(context.TODO()).Execute()
21 | if err != nil {
22 | return fmt.Errorf("unable to list opal message channels: %v", err)
23 | }
24 |
25 | countByName := make(map[string]int)
26 |
27 | for _, channel := range messageChannels.Channels {
28 | name := normalizeResourceName(*channel.Name)
29 | if count, ok := countByName[name]; ok {
30 | countByName[name] = count + 1
31 | name = normalizeResourceName(fmt.Sprintf("%s_%d", *channel.Name, count+1))
32 | } else {
33 | countByName[name] = 1
34 | }
35 |
36 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
37 | channel.MessageChannelId,
38 | name,
39 | "opal_message_channel",
40 | "opal",
41 | []string{},
42 | ))
43 | }
44 |
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/opal/on_call_schedule.go:
--------------------------------------------------------------------------------
1 | package opal
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type OnCallScheduleGenerator struct {
11 | OpalService
12 | }
13 |
14 | func (g *OnCallScheduleGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to list opal on call schedules: %v", err)
18 | }
19 |
20 | onCallSchedules, _, err := client.OnCallSchedulesApi.GetOnCallSchedules(context.TODO()).Execute()
21 | if err != nil {
22 | return fmt.Errorf("unable to list opal on call schedules: %v", err)
23 | }
24 |
25 | countByName := make(map[string]int)
26 |
27 | for _, onCallSchedule := range onCallSchedules.OnCallSchedules {
28 | name := normalizeResourceName(*onCallSchedule.Name)
29 | if count, ok := countByName[name]; ok {
30 | countByName[name] = count + 1
31 | name = normalizeResourceName(fmt.Sprintf("%s_%d", *onCallSchedule.Name, count+1))
32 | } else {
33 | countByName[name] = 1
34 | }
35 |
36 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
37 | *onCallSchedule.OnCallScheduleId,
38 | name,
39 | "opal_on_call_schedule",
40 | "opal",
41 | []string{},
42 | ))
43 | }
44 |
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/opal/opal_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package opal
16 |
17 | import (
18 | "fmt"
19 | "net/url"
20 | "path"
21 |
22 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
23 | "github.com/opalsecurity/opal-go"
24 | )
25 |
26 | type OpalService struct { //nolint
27 | terraformutils.Service
28 | }
29 |
30 | func (s *OpalService) newClient() (*opal.APIClient, error) {
31 | conf := opal.NewConfiguration()
32 |
33 | conf.DefaultHeader["Authorization"] = fmt.Sprintf("Bearer %s", s.GetArgs()["token"].(string))
34 | u, err := url.Parse(s.GetArgs()["base_url"].(string))
35 | if err != nil {
36 | return nil, err
37 | }
38 | u.Path = path.Join(u.Path, "/v1")
39 | conf.Servers = opal.ServerConfigurations{{
40 | URL: u.String(),
41 | }}
42 |
43 | return opal.NewAPIClient(conf), nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/opal/owner.go:
--------------------------------------------------------------------------------
1 | package opal
2 |
3 | import (
4 | "context"
5 | "fmt"
6 |
7 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
8 | )
9 |
10 | type OwnerGenerator struct {
11 | OpalService
12 | }
13 |
14 | func (g *OwnerGenerator) InitResources() error {
15 | client, err := g.newClient()
16 | if err != nil {
17 | return fmt.Errorf("unable to list opal owners: %v", err)
18 | }
19 |
20 | owners, _, err := client.OwnersApi.GetOwners(context.TODO()).Execute()
21 | if err != nil {
22 | return fmt.Errorf("unable to list opal owners: %v", err)
23 | }
24 |
25 | countByName := make(map[string]int)
26 |
27 | for {
28 | for _, owner := range owners.Results {
29 | name := normalizeResourceName(*owner.Name)
30 | if count, ok := countByName[name]; ok {
31 | countByName[name] = count + 1
32 | name = normalizeResourceName(fmt.Sprintf("%s_%d", *owner.Name, count+1))
33 | } else {
34 | countByName[name] = 1
35 | }
36 |
37 | g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
38 | owner.OwnerId,
39 | name,
40 | "opal_owner",
41 | "opal",
42 | []string{},
43 | ))
44 | }
45 |
46 | if !owners.HasNext() || owners.Next.Get() == nil {
47 | break
48 | }
49 |
50 | owners, _, err = client.OwnersApi.GetOwners(context.TODO()).Cursor(*owners.Next.Get()).Execute()
51 | if err != nil {
52 | return fmt.Errorf("unable to list opal owners: %v", err)
53 | }
54 | }
55 |
56 | return nil
57 | }
58 |
--------------------------------------------------------------------------------
/providers/openstack/openstack_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package openstack
16 |
17 | import "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 |
19 | type OpenStackService struct { //nolint
20 | terraformutils.Service
21 | }
22 |
--------------------------------------------------------------------------------
/providers/opsgenie/opsgenie_service.go:
--------------------------------------------------------------------------------
1 | package opsgenie
2 |
3 | import (
4 | "github.com/opsgenie/opsgenie-go-sdk-v2/client"
5 | "github.com/opsgenie/opsgenie-go-sdk-v2/service"
6 | "github.com/opsgenie/opsgenie-go-sdk-v2/team"
7 | "github.com/opsgenie/opsgenie-go-sdk-v2/user"
8 |
9 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
10 | )
11 |
12 | type OpsgenieService struct { //nolint
13 | terraformutils.Service
14 | }
15 |
16 | func (s *OpsgenieService) UserClient() (*user.Client, error) {
17 | return user.NewClient(&client.Config{ApiKey: s.GetArgs()["api-key"].(string)})
18 | }
19 |
20 | func (s *OpsgenieService) TeamClient() (*team.Client, error) {
21 | return team.NewClient(&client.Config{ApiKey: s.GetArgs()["api-key"].(string)})
22 | }
23 |
24 | func (s *OpsgenieService) ServiceClient() (*service.Client, error) {
25 | return service.NewClient(&client.Config{ApiKey: s.GetArgs()["api-key"].(string)})
26 | }
27 |
--------------------------------------------------------------------------------
/providers/opsgenie/service.go:
--------------------------------------------------------------------------------
1 | package opsgenie
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/opsgenie/opsgenie-go-sdk-v2/service"
9 |
10 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
11 | )
12 |
13 | type ServiceGenerator struct {
14 | OpsgenieService
15 | }
16 |
17 | func (g *ServiceGenerator) InitResources() error {
18 | client, err := g.ServiceClient()
19 | if err != nil {
20 | return err
21 | }
22 |
23 | limit := 50
24 | offset := 0
25 |
26 | var services []service.Service
27 |
28 | for {
29 | result, err := func(limit, offset int) (*service.ListResult, error) {
30 | ctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)
31 | defer cancelFunc()
32 |
33 | return client.List(ctx, &service.ListRequest{Limit: limit, Offset: offset})
34 | }(limit, offset)
35 |
36 | if err != nil {
37 | return err
38 | }
39 |
40 | if len(result.Services) == 0 {
41 | break
42 | }
43 |
44 | services = append(services, result.Services...)
45 | offset += limit
46 | }
47 |
48 | g.Resources = g.createResources(services)
49 | return nil
50 | }
51 |
52 | func (g *ServiceGenerator) createResources(services []service.Service) []terraformutils.Resource {
53 | var resources []terraformutils.Resource
54 |
55 | for _, s := range services {
56 | resources = append(resources, terraformutils.NewResource(
57 | s.Id,
58 | fmt.Sprintf("%s-%s", s.Id, s.Name),
59 | "opsgenie_service",
60 | g.ProviderName,
61 | map[string]string{},
62 | []string{},
63 | map[string]interface{}{},
64 | ))
65 | }
66 |
67 | return resources
68 | }
69 |
--------------------------------------------------------------------------------
/providers/opsgenie/team.go:
--------------------------------------------------------------------------------
1 | package opsgenie
2 |
3 | import (
4 | "context"
5 | "time"
6 |
7 | "github.com/opsgenie/opsgenie-go-sdk-v2/team"
8 |
9 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
10 | )
11 |
12 | type TeamGenerator struct {
13 | OpsgenieService
14 | }
15 |
16 | func (g *TeamGenerator) InitResources() error {
17 | client, err := g.TeamClient()
18 | if err != nil {
19 | return err
20 | }
21 |
22 | ctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)
23 | defer cancelFunc()
24 |
25 | result, err := client.List(ctx, &team.ListTeamRequest{})
26 | if err != nil {
27 | return err
28 | }
29 |
30 | g.Resources = g.createResources(result.Teams)
31 | return nil
32 | }
33 |
34 | func (g *TeamGenerator) createResources(teams []team.ListedTeams) []terraformutils.Resource {
35 | var resources []terraformutils.Resource
36 |
37 | for _, t := range teams {
38 | resources = append(resources, terraformutils.NewResource(
39 | t.Id,
40 | t.Name,
41 | "opsgenie_team",
42 | g.ProviderName,
43 | map[string]string{},
44 | []string{},
45 | map[string]interface{}{},
46 | ))
47 | }
48 |
49 | return resources
50 | }
51 |
--------------------------------------------------------------------------------
/providers/opsgenie/user.go:
--------------------------------------------------------------------------------
1 | package opsgenie
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/opsgenie/opsgenie-go-sdk-v2/user"
9 |
10 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
11 | )
12 |
13 | type UserGenerator struct {
14 | OpsgenieService
15 | }
16 |
17 | func (g *UserGenerator) InitResources() error {
18 | client, err := g.UserClient()
19 | if err != nil {
20 | return err
21 | }
22 |
23 | limit := 50
24 | offset := 0
25 |
26 | var users []user.User
27 |
28 | for {
29 | result, err := func(limit, offset int) (*user.ListResult, error) {
30 | ctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)
31 | defer cancelFunc()
32 |
33 | return client.List(ctx, &user.ListRequest{Limit: limit, Offset: offset})
34 | }(limit, offset)
35 |
36 | if err != nil {
37 | return err
38 | }
39 |
40 | users = append(users, result.Users...)
41 | offset += limit
42 |
43 | if offset >= result.TotalCount {
44 | break
45 | }
46 | }
47 |
48 | g.Resources = g.createResources(users)
49 | return nil
50 | }
51 |
52 | func (g *UserGenerator) createResources(users []user.User) []terraformutils.Resource {
53 | var resources []terraformutils.Resource
54 |
55 | for _, u := range users {
56 | resources = append(resources, terraformutils.NewResource(
57 | u.Id,
58 | fmt.Sprintf("%s-%s", u.Id, u.Username),
59 | "opsgenie_user",
60 | g.ProviderName,
61 | map[string]string{},
62 | []string{},
63 | map[string]interface{}{},
64 | ))
65 | }
66 |
67 | return resources
68 | }
69 |
--------------------------------------------------------------------------------
/providers/pagerduty/pagerduty_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package pagerduty
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | pagerduty "github.com/heimweh/go-pagerduty/pagerduty"
20 | )
21 |
22 | type PagerDutyService struct { //nolint
23 | terraformutils.Service
24 | }
25 |
26 | func (s *PagerDutyService) Client() (*pagerduty.Client, error) {
27 | client, err := pagerduty.NewClient(&pagerduty.Config{Token: s.GetArgs()["token"].(string)})
28 | if err != nil {
29 | return nil, err
30 | }
31 | return client, nil
32 | }
33 |
--------------------------------------------------------------------------------
/providers/panos/panos_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package panos
16 |
17 | import (
18 | "errors"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | )
22 |
23 | type PanosService struct { //nolint
24 | terraformutils.Service
25 | client interface{}
26 | vsys string
27 | }
28 |
29 | func (p *PanosService) Initialize() error {
30 | if _, ok := p.Args["vsys"].(string); ok {
31 | p.vsys = p.Args["vsys"].(string)
32 | } else {
33 | return errors.New(p.GetName() + ": " + "vsys name not parsable")
34 | }
35 |
36 | c, err := Initialize()
37 | if err != nil {
38 | return err
39 | }
40 |
41 | p.client = c
42 |
43 | return nil
44 | }
45 |
--------------------------------------------------------------------------------
/providers/rabbitmq/rabbitmq_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package rabbitmq
16 |
17 | import (
18 | "io"
19 | "net/http"
20 |
21 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
22 | )
23 |
24 | type RBTService struct { //nolint
25 | terraformutils.Service
26 | }
27 |
28 | func (s *RBTService) generateRequest(uri string) ([]byte, error) {
29 | tr := &http.Transport{}
30 | client := &http.Client{Transport: tr}
31 | req, err := http.NewRequest("GET", s.Args["endpoint"].(string)+uri, nil)
32 | if err != nil {
33 | return nil, err
34 | }
35 | req.SetBasicAuth(s.Args["username"].(string), s.Args["password"].(string))
36 | resp, err := client.Do(req)
37 | if err != nil {
38 | return nil, err
39 | }
40 | defer resp.Body.Close()
41 | body, err := io.ReadAll(resp.Body)
42 | if err != nil {
43 | return nil, err
44 | }
45 | return body, nil
46 | }
47 |
--------------------------------------------------------------------------------
/providers/tencentcloud/tencentcloud_helpers.go:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package tencentcloud
16 |
17 | func Bool(i bool) *bool { return &i }
18 |
19 | func String(i string) *string { return &i }
20 |
21 | func Int(i int) *int { return &i }
22 |
23 | func Uint(i uint) *uint { return &i }
24 |
25 | func Int64(i int64) *int64 { return &i }
26 |
27 | func Float64(i float64) *float64 { return &i }
28 |
29 | func Uint64(i uint64) *uint64 { return &i }
30 |
31 | func IntInt64(i int) *int64 {
32 | i64 := int64(i)
33 | return &i64
34 | }
35 |
36 | func IntUint64(i int) *uint64 {
37 | u := uint64(i)
38 | return &u
39 | }
40 |
41 | func Int64Uint64(i int64) *uint64 {
42 | u := uint64(i)
43 | return &u
44 | }
45 |
46 | func UInt64Int64(i uint64) *int64 {
47 | u := int64(i)
48 | return &u
49 | }
50 |
--------------------------------------------------------------------------------
/providers/tencentcloud/tencentcloud_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package tencentcloud
16 |
17 | import "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 |
19 | type TencentCloudService struct { //nolint
20 | terraformutils.Service
21 | }
22 |
--------------------------------------------------------------------------------
/providers/vultr/network.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/vultr/govultr"
22 | )
23 |
24 | type NetworkGenerator struct {
25 | VultrService
26 | }
27 |
28 | func (g NetworkGenerator) createResources(networkList []govultr.Network) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, network := range networkList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | network.NetworkID,
33 | network.NetworkID,
34 | "vultr_network",
35 | "vultr",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *NetworkGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.Network.List(context.Background())
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/vultr/reserved_ip.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/vultr/govultr"
22 | )
23 |
24 | type ReservedIPGenerator struct {
25 | VultrService
26 | }
27 |
28 | func (g ReservedIPGenerator) createResources(ipList []govultr.ReservedIP) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, ip := range ipList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | ip.ReservedIPID,
33 | ip.ReservedIPID,
34 | "vultr_reserved_ip",
35 | "vultr",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *ReservedIPGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.ReservedIP.List(context.Background())
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/vultr/server.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/vultr/govultr"
22 | )
23 |
24 | type ServerGenerator struct {
25 | VultrService
26 | }
27 |
28 | func (g ServerGenerator) createResources(serverList []govultr.Server) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, server := range serverList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | server.InstanceID,
33 | server.InstanceID,
34 | "vultr_server",
35 | "vultr",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *ServerGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.Server.List(context.Background())
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/vultr/snapshot.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/vultr/govultr"
22 | )
23 |
24 | type SnapshotGenerator struct {
25 | VultrService
26 | }
27 |
28 | func (g SnapshotGenerator) createResources(snapshotList []govultr.Snapshot) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, snapshot := range snapshotList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | snapshot.SnapshotID,
33 | snapshot.SnapshotID,
34 | "vultr_snapshot",
35 | "vultr",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *SnapshotGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.Snapshot.List(context.Background())
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/vultr/ssh_key.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/vultr/govultr"
22 | )
23 |
24 | type SSHKeyGenerator struct {
25 | VultrService
26 | }
27 |
28 | func (g SSHKeyGenerator) createResources(keyList []govultr.SSHKey) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, key := range keyList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | key.SSHKeyID,
33 | key.SSHKeyID,
34 | "vultr_ssh_key",
35 | "vultr",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *SSHKeyGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.SSHKey.List(context.Background())
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/vultr/startup_script.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/vultr/govultr"
22 | )
23 |
24 | type StartupScriptGenerator struct {
25 | VultrService
26 | }
27 |
28 | func (g StartupScriptGenerator) createResources(scriptList []govultr.StartupScript) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, script := range scriptList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | script.ScriptID,
33 | script.ScriptID,
34 | "vultr_startup_script",
35 | "vultr",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *StartupScriptGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.StartupScript.List(context.Background())
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/vultr/user.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "context"
19 |
20 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
21 | "github.com/vultr/govultr"
22 | )
23 |
24 | type UserGenerator struct {
25 | VultrService
26 | }
27 |
28 | func (g UserGenerator) createResources(userList []govultr.User) []terraformutils.Resource {
29 | var resources []terraformutils.Resource
30 | for _, user := range userList {
31 | resources = append(resources, terraformutils.NewSimpleResource(
32 | user.UserID,
33 | user.UserID,
34 | "vultr_user",
35 | "vultr",
36 | []string{}))
37 | }
38 | return resources
39 | }
40 |
41 | func (g *UserGenerator) InitResources() error {
42 | client := g.generateClient()
43 | output, err := client.User.List(context.Background())
44 | if err != nil {
45 | return err
46 | }
47 | g.Resources = g.createResources(output)
48 | return nil
49 | }
50 |
--------------------------------------------------------------------------------
/providers/vultr/vultr_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package vultr
16 |
17 | import (
18 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
19 | "github.com/vultr/govultr"
20 | )
21 |
22 | type VultrService struct { //nolint
23 | terraformutils.Service
24 | }
25 |
26 | func (s *VultrService) generateClient() *govultr.Client {
27 | return govultr.NewClient(nil, s.Args["api_key"].(string))
28 | }
29 |
--------------------------------------------------------------------------------
/providers/xenorchestra/acls.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | package xenorchestra
15 |
16 | import (
17 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 | "github.com/ddelnano/terraform-provider-xenorchestra/client"
19 | )
20 |
21 | type AclGenerator struct { //nolint
22 | XenorchestraService
23 | }
24 |
25 | func (g AclGenerator) createResources(acls []client.Acl) []terraformutils.Resource {
26 | var resources []terraformutils.Resource
27 | for _, acl := range acls {
28 | resourceName := acl.Id
29 | resources = append(resources, terraformutils.NewSimpleResource(
30 | acl.Id,
31 | resourceName,
32 | "xenorchestra_acl",
33 | "xenorchestra",
34 | []string{}))
35 | }
36 | return resources
37 | }
38 |
39 | func (g *AclGenerator) InitResources() error {
40 | client := g.generateClient()
41 | acls, err := client.GetAcls()
42 |
43 | if err != nil {
44 | return err
45 | }
46 | g.Resources = g.createResources(acls)
47 | return nil
48 | }
49 |
--------------------------------------------------------------------------------
/providers/xenorchestra/resource_sets.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | package xenorchestra
15 |
16 | import (
17 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 | "github.com/ddelnano/terraform-provider-xenorchestra/client"
19 | )
20 |
21 | type ResourceSetGenerator struct {
22 | XenorchestraService
23 | }
24 |
25 | func (g ResourceSetGenerator) createResources(acls []client.ResourceSet) []terraformutils.Resource {
26 | var resources []terraformutils.Resource
27 | for _, acl := range acls {
28 | resourceName := acl.Id
29 | resources = append(resources, terraformutils.NewSimpleResource(
30 | acl.Id,
31 | resourceName,
32 | "xenorchestra_resource_set",
33 | "xenorchestra",
34 | []string{}))
35 | }
36 | return resources
37 | }
38 |
39 | func (g *ResourceSetGenerator) InitResources() error {
40 | client := g.generateClient()
41 | acls, err := client.GetResourceSets()
42 |
43 | if err != nil {
44 | return err
45 | }
46 | g.Resources = g.createResources(acls)
47 | return nil
48 | }
49 |
--------------------------------------------------------------------------------
/providers/xenorchestra/xenorchestra_service.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | package xenorchestra
15 |
16 | import (
17 | "github.com/GoogleCloudPlatform/terraformer/terraformutils"
18 | "github.com/ddelnano/terraform-provider-xenorchestra/client"
19 | )
20 |
21 | type XenorchestraService struct { //nolint
22 | terraformutils.Service
23 | }
24 |
25 | func (m *XenorchestraService) generateClient() *client.Client {
26 | config := client.Config{
27 | Url: m.Args["url"].(string),
28 | Username: m.Args["username"].(string),
29 | Password: m.Args["password"].(string),
30 | }
31 | client, _ := client.NewClient(config)
32 | return client
33 | }
34 |
--------------------------------------------------------------------------------
/providers/yandex/util.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package yandex
16 |
17 | const defaultPageSize = 1000
18 |
--------------------------------------------------------------------------------
/terraformutils/flatmap_test.go:
--------------------------------------------------------------------------------
1 | package terraformutils
2 |
3 | import (
4 | "regexp"
5 | "testing"
6 |
7 | "github.com/zclconf/go-cty/cty"
8 | )
9 |
10 | func TestNestedAttributeFiltering(t *testing.T) {
11 | attributes := map[string]string{
12 | "attribute": "value1",
13 | "nested.attribute": "value2",
14 | }
15 |
16 | ignoreKeys := []*regexp.Regexp{
17 | regexp.MustCompile(`^attribute$`),
18 | }
19 | parser := NewFlatmapParser(attributes, ignoreKeys, []*regexp.Regexp{})
20 |
21 | attributesType := cty.Object(map[string]cty.Type{
22 | "attribute": cty.String,
23 | "nested": cty.Object(map[string]cty.Type{
24 | "attribute": cty.String,
25 | }),
26 | })
27 |
28 | result, _ := parser.Parse(attributesType)
29 |
30 | if _, ok := result["attribute"]; ok {
31 | t.Errorf("failed to resolve %v", result)
32 | }
33 | if val, ok := result["nested"].(map[string]interface{})["attribute"]; !ok && val != "value2" {
34 | t.Errorf("failed to resolve %v", result)
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/terraformutils/json.go:
--------------------------------------------------------------------------------
1 | package terraformutils
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "log"
7 | "regexp"
8 | "strings"
9 | )
10 |
11 | var OpeningBracketRegexp = regexp.MustCompile(`.?\\<`)
12 | var ClosingBracketRegexp = regexp.MustCompile(`.?\\>`)
13 |
14 | func jsonPrint(data interface{}) ([]byte, error) {
15 | dataJSONBytes, err := json.MarshalIndent(data, "", " ")
16 | if err != nil {
17 | log.Println(string(dataJSONBytes))
18 | return []byte{}, fmt.Errorf("error marshalling terraform data to json: %v", err)
19 | }
20 | // We don't need to escape > or <
21 | s := strings.ReplaceAll(string(dataJSONBytes), "\\u003c", "<")
22 | s = OpeningBracketRegexp.ReplaceAllStringFunc(s, escapingBackslashReplacer("<"))
23 | s = strings.ReplaceAll(s, "\\u003e", ">")
24 | s = ClosingBracketRegexp.ReplaceAllStringFunc(s, escapingBackslashReplacer(">"))
25 | return []byte(s), nil
26 | }
27 |
28 | func escapingBackslashReplacer(backslashedCharacter string) func(string) string {
29 | return func(match string) string {
30 | if strings.HasPrefix(match, "\\\\") {
31 | return match // Don't replace regular backslashes
32 | }
33 | return strings.Replace(match, "\\"+backslashedCharacter, backslashedCharacter, 1)
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/terraformutils/terraformerstring/string.go:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The Terraformer Authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package terraformerstring
16 |
17 | func ContainsString(s []string, e string) bool {
18 | for _, a := range s {
19 | if a == e {
20 | return true
21 | }
22 | }
23 | return false
24 | }
25 |
--------------------------------------------------------------------------------
/terraformutils/test_data/test1.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "direction": "INGRESS",
20 | "enable_logging": "false",
21 | "id": "resource-id",
22 | "name": "resource-name"
23 | },
24 | "meta": {
25 | "schema_version": "1"
26 | },
27 | "tainted": false
28 | },
29 | "deposed": [],
30 | "provider": "provider.google"
31 | }
32 | }
33 | }
34 | ]
35 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test2.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-idA": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-idA",
18 | "attributes": {
19 | "direction": "INGRESS",
20 | "enable_logging": "false",
21 | "id": "resource-idA",
22 | "name": "resource-nameA"
23 | },
24 | "meta": {
25 | "schema_version": "1"
26 | },
27 | "tainted": false
28 | },
29 | "deposed": [],
30 | "provider": "provider.google"
31 | },
32 | "google_compute_firewall.resource-idB": {
33 | "type": "google_compute_firewall",
34 | "depends_on": [],
35 | "primary": {
36 | "id": "resource-idB",
37 | "attributes": {
38 | "direction": "INGRESS",
39 | "enable_logging": "false",
40 | "id": "resource-idB",
41 | "name": "resource-nameB"
42 | },
43 | "meta": {
44 | "schema_version": "1"
45 | },
46 | "tainted": false
47 | },
48 | "deposed": [],
49 | "provider": "provider.google"
50 | }
51 | }
52 | }
53 | ]
54 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test3.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "myarray.#": "1",
20 | "myarray.0.value1": "value1",
21 | "myarray.0.value2": "value2",
22 | "myarray.1.value3": "value3",
23 | "myarray.1.value4": "value4",
24 | "direction": "INGRESS",
25 | "enable_logging": "false",
26 | "id": "resource-id",
27 | "name": "resource-name"
28 | },
29 | "meta": {
30 | "schema_version": "1"
31 | },
32 | "tainted": false
33 | },
34 | "deposed": [],
35 | "provider": "provider.google"
36 | }
37 | }
38 | }
39 | ]
40 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test4.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "myarray.#": "2",
20 | "myarray.0.subarray1.1245": "value1",
21 | "myarray.0.subarray1.12454": "value2",
22 | "myarray.1.subarray3.123456": "value3",
23 | "myarray.1.subarray4": "value4",
24 | "direction": "INGRESS",
25 | "enable_logging": "false",
26 | "id": "resource-id",
27 | "name": "resource-name"
28 | },
29 | "meta": {
30 | "schema_version": "1"
31 | },
32 | "tainted": false
33 | },
34 | "deposed": [],
35 | "provider": "provider.google"
36 | }
37 | }
38 | }
39 | ]
40 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test5.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "myarray.#": "1",
20 | "myarray.1245": "value1",
21 | "myarray.12455": "value2",
22 | "myarray.12455778": "value3",
23 | "myarray2.#": "2",
24 | "myarray2.0.subarray3.123456.subsubarray": "value3",
25 | "myarray2.1.subarray4": "value4",
26 | "direction": "INGRESS",
27 | "enable_logging": "false",
28 | "id": "resource-id",
29 | "name": "resource-name"
30 | },
31 | "meta": {
32 | "schema_version": "1"
33 | },
34 | "tainted": false
35 | },
36 | "deposed": [],
37 | "provider": "provider.google"
38 | }
39 | }
40 | }
41 | ]
42 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test6.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "lifecycle_rule.#": "1",
20 | "lifecycle_rule.0.action.#": "1",
21 | "lifecycle_rule.0.action.4029382586.storage_class": "",
22 | "lifecycle_rule.0.action.4029382586.type": "Delete",
23 | "lifecycle_rule.0.condition.#": "1",
24 | "lifecycle_rule.0.condition.395037683.age": "1",
25 | "lifecycle_rule.0.condition.395037683.created_before": "",
26 | "lifecycle_rule.0.condition.395037683.is_live": "false",
27 | "lifecycle_rule.0.condition.395037683.matches_storage_class.#": "0",
28 | "lifecycle_rule.0.condition.395037683.num_newer_versions": "0",
29 | "direction": "INGRESS",
30 | "enable_logging": "false",
31 | "id": "resource-id",
32 | "name": "resource-name"
33 | },
34 | "meta": {
35 | "schema_version": "1"
36 | },
37 | "tainted": false
38 | },
39 | "deposed": [],
40 | "provider": "provider.google"
41 | }
42 | }
43 | }
44 | ]
45 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test7.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "direction": "INGRESS",
20 | "enable_logging": "false",
21 | "ignored": "no value",
22 | "more.3.regex": "no value",
23 | "id": "resource-id",
24 | "name": "resource-name"
25 | },
26 | "meta": {
27 | "schema_version": "1"
28 | },
29 | "tainted": false
30 | },
31 | "deposed": [],
32 | "provider": "provider.google"
33 | }
34 | }
35 | }
36 | ]
37 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test8.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "direction": "INGRESS",
20 | "enable_logging": "false",
21 | "id": "resource-id",
22 | "name": "resource-name",
23 | "allow_empty": "",
24 | "not_allow_empty": "",
25 | "boolval": "false",
26 | "intval": "124"
27 | },
28 | "meta": {
29 | "schema_version": "1"
30 | },
31 | "tainted": false
32 | },
33 | "deposed": [],
34 | "provider": "provider.google"
35 | }
36 | }
37 | }
38 | ]
39 | }
--------------------------------------------------------------------------------
/terraformutils/test_data/test9.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "terraform_version": "0.11.10",
4 | "serial": 3,
5 | "lineage": "11c0e8e7-bc2d-8f4c-b40b-25f62ece8666",
6 | "modules": [
7 | {
8 | "path": [
9 | "root"
10 | ],
11 | "outputs": {},
12 | "resources": {
13 | "google_compute_firewall.resource-id": {
14 | "type": "google_compute_firewall",
15 | "depends_on": [],
16 | "primary": {
17 | "id": "resource-id",
18 | "attributes": {
19 | "direction": "INGRESS",
20 | "enable_logging": "false",
21 | "id": "resource-id",
22 | "name": "resource-name",
23 | "allow_empty": "",
24 | "not_allow_empty": "",
25 | "boolval": "false",
26 | "intval": "124"
27 | },
28 | "meta": {
29 | "schema_version": "1"
30 | },
31 | "tainted": false
32 | },
33 | "deposed": [],
34 | "provider": "provider.google"
35 | }
36 | }
37 | }
38 | ]
39 | }
--------------------------------------------------------------------------------
/tests/datadog/resources/downtime.tf:
--------------------------------------------------------------------------------
1 | # Create a Datadog downtime for all monitors
2 | resource "datadog_downtime" "downtime_example" {
3 | scope = ["*"]
4 |
5 | recurrence {
6 | type = "days"
7 | period = 1
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/tests/datadog/resources/monitor.tf:
--------------------------------------------------------------------------------
1 | # Create a new Datadog monitor
2 | resource "datadog_monitor" "monitor_example" {
3 | name = "Name for monitor foo"
4 | type = "metric alert"
5 | message = "Monitor triggered. Notify: @hipchat-channel"
6 | escalation_message = "Escalation message @pagerduty"
7 |
8 | query = "avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 4"
9 |
10 | thresholds = {
11 | ok = 0
12 | warning = 2
13 | warning_recovery = 1
14 | critical = 4
15 | critical_recovery = 3
16 | }
17 |
18 | notify_no_data = false
19 | renotify_interval = 60
20 |
21 | notify_audit = false
22 | timeout_h = 60
23 | include_tags = true
24 |
25 | # ignore any changes in silenced value; using silenced is deprecated in favor of downtimes
26 | lifecycle {
27 | ignore_changes = [silenced]
28 | }
29 |
30 | tags = ["foo:bar", "baz"]
31 | }
32 |
--------------------------------------------------------------------------------
/tests/datadog/resources/outputs.tf:
--------------------------------------------------------------------------------
1 | # Dashboards
2 | output "datadog_dashboard--ordered_dashboard_example" {
3 | value = datadog_dashboard.ordered_dashboard_example.id
4 | }
5 |
6 | output "datadog_dashboard--free_dashboard_example" {
7 | value = datadog_dashboard.free_dashboard_example.id
8 | }
9 |
10 | # Downtimes
11 | output "datadog_downtime--downtime_example" {
12 | value = datadog_downtime.downtime_example.id
13 | }
14 |
15 | # Monitors
16 | output "datadog_monitor--monitor_example" {
17 | value = datadog_monitor.monitor_example.id
18 | }
19 |
20 | # Synthetics
21 | output "datadog_synthetics_test--test_api_example" {
22 | value = datadog_synthetics_test.test_api_example.id
23 | }
24 |
25 | # Users
26 | output "datadog_user--user_example" {
27 | value = datadog_user.user_example.id
28 | }
29 |
30 | output "datadog_user--user_example_two" {
31 | value = datadog_user.user_example_two.id
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/tests/datadog/resources/synthetics.tf:
--------------------------------------------------------------------------------
1 | resource "datadog_synthetics_test" "test_api_example" {
2 | type = "api"
3 | subtype = "http"
4 | request = {
5 | method = "GET"
6 | url = "https://www.example.org"
7 | }
8 | request_headers = {
9 | Content-Type = "application/json"
10 | Authentication = "Token: 1234566789"
11 | }
12 | assertion {
13 | type = "statusCode"
14 | operator = "is"
15 | target = "200"
16 | }
17 | locations = [ "aws:eu-central-1" ]
18 | options_list {
19 | tick_every = 900
20 |
21 | retry {
22 | count = 2
23 | interval = 300
24 | }
25 |
26 | monitor_options {
27 | renotify_interval = 100
28 | }
29 | }
30 | name = "An API test on example.org"
31 | message = "Notify @pagerduty"
32 | tags = ["foo:bar", "foo", "env:test"]
33 |
34 | status = "live"
35 | }
36 |
--------------------------------------------------------------------------------
/tests/datadog/resources/user.tf:
--------------------------------------------------------------------------------
1 | # Create a new Datadog user
2 | resource "datadog_user" "user_example" {
3 | email = "new@example.com"
4 | handle = "new@example.com"
5 | name = "New User"
6 | }
7 |
8 | resource "datadog_user" "user_example_two" {
9 | email = "new_two@example.com"
10 | handle = "new_two@example.com"
11 | name = "New User"
12 | }
13 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/README.md:
--------------------------------------------------------------------------------
1 | # Testing the OctopusDeploy provider
2 |
3 | You will need an OctopusDeploy server:
4 |
5 | ```bash
6 | git clone git@github.com:MattHodge/VagrantBoxes.git
7 | cd VagrantBoxes/OctopusDeployServer
8 | vagrant up
9 | cd -
10 | ```
11 |
12 | Download the provider (pick the right one for your platform):
13 |
14 | ```bash
15 | PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
16 | PLUGIN_DIR=.terraform/plugins/${PLATFORM}_amd64/
17 | PROVIDER=terraform-provider-octopusdeploy_${PLATFORM}_amd64_v0.5.0
18 | mkdir -p "${PLUGIN_DIR}"
19 | cd "${PLUGIN_DIR}"
20 | curl -sLO "https://github.com/OctopusDeploy/terraform-provider-octopusdeploy/releases/download/v0.5.0/${PROVIDER}.zip"
21 | unzip "${PROVIDER}.zip"
22 | mv "${PROVIDER}" terraform-provider-octopusdeploy_v0.5.0
23 | cd -
24 | ```
25 |
26 | Run `terraform` to create the resources (adjust the values in `provider.tf`):
27 |
28 | ```bash
29 | terraform init
30 | terraform plan
31 | terraform apply --auto-approve
32 | ```
33 |
34 | Import them back with `terraformer`:
35 |
36 | ```bash
37 | terraformer import octopusdeploy \
38 | --server "http://localhost:8081" \
39 | --apikey "API-YVLL2ML1XRIBUU8GKJKEMXKPWQ" \
40 | -r accounts,environments,feeds,libraryvariablesets,lifecycles,projects,projectgroups,projecttriggers,tagsets
41 | ```
42 |
43 | Compare the output from `generated/octopusdeploy` with the original files.
44 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/channel.tf:
--------------------------------------------------------------------------------
1 | resource "octopusdeploy_channel" "helm" {
2 | name = "Helm"
3 | description = "The Helm channel"
4 | project_id = octopusdeploy_project.deploymark_api.id
5 | }
6 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/environment.tf:
--------------------------------------------------------------------------------
1 | resource "octopusdeploy_environment" "stage" {
2 | name = "Stage"
3 | description = "Y (SS1)"
4 | use_guided_failure = false
5 | allow_dynamic_infrastructure = true
6 | }
7 |
8 | resource "octopusdeploy_environment" "production" {
9 | name = "Production"
10 | description = "B, C, D, E, F & G and more"
11 | use_guided_failure = true
12 | allow_dynamic_infrastructure = true
13 | }
14 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/feed.tf:
--------------------------------------------------------------------------------
1 | resource "octopusdeploy_feed" "feed" {
2 | name = "feedme"
3 | feed_type = "Helm"
4 | feed_uri = "https://kubernetes-charts.storage.googleapis.com"
5 | username = "foo"
6 | password = "bar"
7 | enhanced_mode = false
8 | }
9 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/library_variable_set.tf:
--------------------------------------------------------------------------------
1 | resource "octopusdeploy_library_variable_set" "foo" {
2 | name = "Account IDs"
3 | description = "Ids of accounts"
4 | }
5 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/lifecycle.tf:
--------------------------------------------------------------------------------
1 | resource "octopusdeploy_lifecycle" "stage_prod" {
2 | name = "Stage-Production"
3 | description = "Stage-Production Lifecycle"
4 |
5 | release_retention_policy {
6 | unit = "Days"
7 | quantity_to_keep = 3
8 | }
9 |
10 | tentacle_retention_policy {
11 | unit = "Items"
12 | quantity_to_keep = 3
13 | }
14 |
15 | phase {
16 | name = "Stage"
17 | minimum_environments_before_promotion = 0
18 | is_optional_phase = false
19 | optional_deployment_targets = ["${octopusdeploy_environment.stage.id}"]
20 | }
21 |
22 | phase {
23 | name = "Production"
24 | minimum_environments_before_promotion = 0
25 | is_optional_phase = false
26 | optional_deployment_targets = ["${octopusdeploy_environment.production.id}"]
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/main.tf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/octopusdeploy/project.tf:
--------------------------------------------------------------------------------
1 | resource "octopusdeploy_project" "deploymark_api" {
2 | name = "Deploymark API"
3 | description = "Annotate deployments"
4 | lifecycle_id = octopusdeploy_lifecycle.stage_prod.id
5 | project_group_id = octopusdeploy_project_group.utilities.id
6 | skip_machine_behavior = "SkipUnavailableMachines"
7 |
8 | deployment_step {
9 | windows_service {
10 | executable_path = "batch_processor\\batch_processor_service.exe"
11 | service_name = "Billing Batch Processor"
12 | step_name = "Deploy Billing Batch Processor Windows Service"
13 | step_condition = "failure"
14 | package = "Billing.BatchProcessor"
15 | json_file_variable_replacement = "appsettings.json"
16 |
17 | target_roles = [
18 | "Billing-Batch-Processor",
19 | ]
20 | }
21 |
22 | inline_script {
23 | step_name = "Cleanup Temporary Files"
24 | script_type = "PowerShell"
25 |
26 | script_body = <