Skip to content

Commit

Permalink
apps: expose live_domain computed attribute. (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething authored Sep 11, 2024
1 parent 1056a95 commit 21f5090
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions digitalocean/app/datasource_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func DataSourceDigitalOceanApp() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"live_domain": {
Type: schema.TypeString,
Computed: true,
},
"active_deployment_id": {
Type: schema.TypeString,
Computed: true,
Expand Down
6 changes: 6 additions & 0 deletions digitalocean/app/resource_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func ResourceDigitalOceanApp() *schema.Resource {
Computed: true,
},

"live_domain": {
Type: schema.TypeString,
Computed: true,
},

// TODO: The full Deployment should be a data source, not a resource
// specify the app id for the active deployment, include a deployment
// id for a specific one
Expand Down Expand Up @@ -161,6 +166,7 @@ func resourceDigitalOceanAppRead(ctx context.Context, d *schema.ResourceData, me
d.SetId(app.ID)
d.Set("default_ingress", app.DefaultIngress)
d.Set("live_url", app.LiveURL)
d.Set("live_domain", app.LiveDomain)
d.Set("updated_at", app.UpdatedAt.UTC().String())
d.Set("created_at", app.CreatedAt.UTC().String())
d.Set("urn", app.URN())
Expand Down
2 changes: 2 additions & 0 deletions digitalocean/app/resource_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func TestAccDigitalOceanApp_Image(t *testing.T) {
Config: fmt.Sprintf(testAccCheckDigitalOceanAppConfig_addImage, appName),
Check: resource.ComposeTestCheckFunc(
testAccCheckDigitalOceanAppExists("digitalocean_app.foobar", &app),
resource.TestCheckResourceAttrSet("digitalocean_app.foobar", "live_url"),
resource.TestCheckResourceAttrSet("digitalocean_app.foobar", "live_domain"),
resource.TestCheckResourceAttr(
"digitalocean_app.foobar", "spec.0.service.0.image.0.registry_type", "DOCKER_HUB"),
resource.TestCheckResourceAttr(
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The following attributes are exported:
- `id` - The ID of the dedicated egress IP.
- `status` - The status of the dedicated egress IP.
* `live_url` - The live URL of the app.
* `live_domain` - The live domain of the app.
* `active_deployment_id` - The ID the app's currently active deployment.
* `urn` - The uniform resource identifier for the app.
* `updated_at` - The date and time of when the app was last updated.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ In addition to the above attributes, the following are exported:
- `id` - The ID of the app.
- `default_ingress` - The default URL to access the app.
- `live_url` - The live URL of the app.
- `live_domain` - The live domain of the app.
- `active_deployment_id` - The ID the app's currently active deployment.
- `urn` - The uniform resource identifier for the app.
- `updated_at` - The date and time of when the app was last updated.
Expand Down

0 comments on commit 21f5090

Please sign in to comment.