MCPcopy Index your code
hub / github.com/apache/cloudstack-terraform-provider

github.com/apache/cloudstack-terraform-provider @apache-license-2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release apache-license-2.0 ↗ · + Follow
342 symbols 965 edges 60 files 18 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

This repository is archived as it's development has been moved to the Apache Foundation. Please find the new home for this provider here: https://github.com/apache/cloudstack-terraform-provider

Terraform Provider

Requirements

  • Terraform 0.10.x
  • Go 1.8 (to build the provider plugin)

Building The Provider

Clone repository to: $GOPATH/src/github.com/xanzy/terraform-provider-cloudstack

$ mkdir -p $GOPATH/src/github.com/xanzy; cd $GOPATH/src/github.com/xanzy
$ git clone git@github.com:xanzy/terraform-provider-cloudstack

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/xanzy/terraform-provider-cloudstack
$ make build

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.8+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make bin
...
$ $GOPATH/bin/terraform-provider-cloudstack
...

Testing the Provider

In order to test the provider, you can simply run make test.

$ make test

In order to run the full suite of Acceptance tests you will need to run the CloudStack Simulator. Please follow these steps to prepare an environment for running the Acceptance tests:

$ docker pull svanharmelen/simulator:4.12.0.0
$ docker run -d -p 8080:8080 --name cloudstack svanharmelen/simulator:4.12.0.0

When Docker started the container you can go to http://localhost:8080/client and login to the CloudStack UI as user admin with password password. It can take a few minutes for the container is fully ready, so you probably need to wait and refresh the page for a few minutes before the login page is shown.

Once the login page is shown and you can login, you need to provision a simulated data-center:

$ docker exec -ti cloudstack python /root/tools/marvin/marvin/deployDataCenter.py -i /root/setup/dev/advanced.cfg

If you refresh the client or login again, you will now get passed the initial welcome screen and be able to go to your account details and retrieve the API key and secret. Export those together with the URL:

$ export CLOUDSTACK_API_URL=http://localhost:8080/client/api
$ export CLOUDSTACK_API_KEY=r_gszj7e0ttr_C6CP5QU_1IV82EIOtK4o_K9i_AltVztfO68wpXihKs2Tms6tCMDY4HDmbqHc-DtTamG5x112w
$ export CLOUDSTACK_SECRET_KEY=tsfMDShFe94f4JkJfEh6_tZZ--w5jqEW7vGL2tkZGQgcdbnxNoq9fRmwAtU5MEGGXOrDlNA6tfvGK14fk_MB6w

In order for all the tests to pass, you will need to create a new (empty) project in the UI called terraform. When the project is created you can run the Acceptance tests against the CloudStack Simulator by simply runnning:

$ make testacc

Extension points exported contracts — how you extend this code

RetryFunc (FuncType)
RetryFunc is the function retried n times
cloudstack/resources.go

Core symbols most depended-on inside this repo

Error
called by 53
cloudstack/resources.go
setValueOrID
called by 27
cloudstack/resources.go
retrieveID
called by 24
cloudstack/resources.go
setProjectid
called by 18
cloudstack/resources.go
tagsFromSchema
called by 8
cloudstack/tags.go
tagsSchema
called by 7
cloudstack/tags.go
setTags
called by 6
cloudstack/tags.go
Retry
called by 6
cloudstack/resources.go

Shape

Function 328
Method 10
Struct 2
FuncType 1
Interface 1

Languages

Go100%

Modules by API surface

cloudstack/resource_cloudstack_security_group_rule.go21 symbols
cloudstack/resource_cloudstack_network_acl_rule.go12 symbols
cloudstack/resource_cloudstack_instance_test.go12 symbols
cloudstack/resource_cloudstack_firewall.go11 symbols
cloudstack/resource_cloudstack_egress_firewall.go11 symbols
cloudstack/resource_cloudstack_port_forward.go10 symbols
cloudstack/resource_cloudstack_network_test.go10 symbols
cloudstack/resources.go9 symbols
cloudstack/resource_cloudstack_disk.go9 symbols
cloudstack/resource_cloudstack_disk_test.go8 symbols
cloudstack/resource_cloudstack_vpn_customer_gateway_test.go7 symbols
cloudstack/resource_cloudstack_loadbalancer_rule_test.go7 symbols

For agents

$ claude mcp add cloudstack-terraform-provider \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact