# ResourceWithEnvironment

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `interface`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Represents a resource that is associated with an environment.

## Definition

```go
type ResourceWithEnvironment interface{}
```

## Methods

A marker interface declares no methods of its own in Go. Its functions are declared on the concrete types they apply to.

- [WithCertificateTrustScope](/reference/api/go/aspire.hosting/resourcewithenvironment/withcertificatetrustscope.md) -- `method` -- Sets the certificate trust scope
  ```go
  WithCertificateTrustScope(scope CertificateTrustScope) ResourceWithEnvironment
  ```
- [WithDeveloperCertificateTrust](/reference/api/go/aspire.hosting/resourcewithenvironment/withdevelopercertificatetrust.md) -- `method` -- Indicates whether developer certificates should be treated as trusted certificate authorities for the resource at run time. Currently this indicates trust for the ASP.NET Core developer certificate. The developer certificate will only be trusted when running in local development scenarios; in publish mode resources will use their default certificate trust.
  ```go
  WithDeveloperCertificateTrust(trust bool) ResourceWithEnvironment
  ```
- [WithEnvironment](/reference/api/go/aspire.hosting/resourcewithenvironment/withenvironment.md) -- `method` -- Sets an environment variable
  ```go
  WithEnvironment(name string, value any) ResourceWithEnvironment
  ```
- [WithEnvironmentCallback](/reference/api/go/aspire.hosting/resourcewithenvironment/withenvironmentcallback.md) -- `method` -- Allows for the population of environment variables on a resource.
  ```go
  WithEnvironmentCallback(callback func(arg EnvironmentCallbackContext)) ResourceWithEnvironment
  ```
- [WithHttpsCertificateConfiguration](/reference/api/go/aspire.hosting/resourcewithenvironment/withhttpscertificateconfiguration.md) -- `method` -- Adds a callback that allows configuring the resource to use a specific HTTPS/TLS certificate key pair for server authentication.
  ```go
  WithHttpsCertificateConfiguration(callback func(arg HttpsCertificateConfigurationCallbackAnnotationContext)) ResourceWithEnvironment
  ```
- [WithHttpsDeveloperCertificate](/reference/api/go/aspire.hosting/resourcewithenvironment/withhttpsdevelopercertificate.md) -- `method` -- Indicates that a resource should use the developer certificate key pair for HTTPS endpoints at run time. Currently this indicates use of the ASP.NET Core developer certificate. The developer certificate will only be used when running in local development scenarios; in publish mode resources will use their default certificate configuration.
  ```go
  WithHttpsDeveloperCertificate(options ...*WithHttpsDeveloperCertificateOptions) ResourceWithEnvironment
  ```
- [WithOtlpExporter](/reference/api/go/aspire.hosting/resourcewithenvironment/withotlpexporter.md) -- `method` -- Configures OTLP telemetry export
  ```go
  WithOtlpExporter(options ...*WithOtlpExporterOptions) ResourceWithEnvironment
  ```
- [WithoutHttpsCertificate](/reference/api/go/aspire.hosting/resourcewithenvironment/withouthttpscertificate.md) -- `method` -- Disable HTTPS/TLS server certificate configuration for the resource. No HTTPS/TLS termination configuration will be applied.
  ```go
  WithoutHttpsCertificate() ResourceWithEnvironment
  ```
- [WithReference](/reference/api/go/aspire.hosting/resourcewithenvironment/withreference.md) -- `method` -- Adds a reference to another resource
  ```go
  WithReference(source any, options ...*WithReferenceOptions) ResourceWithEnvironment
  ```
- [WithReferenceEnvironment](/reference/api/go/aspire.hosting/resourcewithenvironment/withreferenceenvironment.md) -- `method` -- Configures how information is injected into environment variables when the resource references other resources.
  ```go
  WithReferenceEnvironment(options *ReferenceEnvironmentInjectionOptions) ResourceWithEnvironment
  ```

## Applies to

- [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
- [`CSharpAppResource`](/reference/api/go/aspire.hosting/csharpappresource.md)
- [`DotnetToolResource`](/reference/api/go/aspire.hosting/dotnettoolresource.md)
- [`ExecutableResource`](/reference/api/go/aspire.hosting/executableresource.md)
- [`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md)
