sai3563 commented on issue #31058:
URL: https://github.com/apache/airflow/issues/31058#issuecomment-2080009300

   @eladkal @shivannakarthik It seems no modifications in the 
`DataprocCreateClusterOperator` are needed. While testing with the latest dev 
branch i.e. `2.10.0.dev0`, I was able to get `shielded_instance_config` working 
using the operator. I tried it with both True and False values for the 
parameters and confirmed it to be working from GCP Console.
   
   Here is the full code I used
   
   ```
   from datetime import datetime, timedelta
   from airflow import DAG
   from airflow.providers.google.cloud.operators.dataproc import 
DataprocCreateClusterOperator
   
   # Constants
   PROJECT_ID = 'my-project'
   REGION = 'asia-south1'
   CLUSTER_NAME = 'testing-cluster'
   ZONE = 'asia-south1-a'
   
   # Default DAG arguments
   default_args = {
       'start_date': datetime.now() - timedelta(days=1)
   }
   
   # Define the DAG
   dag = DAG(
       'dataproc_create_cluster_dag',
       default_args=default_args,
       description='A DAG to create a Dataproc cluster',
       schedule=None,
       catchup=False
   )
   
   # Dataproc cluster configuration
   cluster_config = {
       "gce_cluster_config": {
           "zone_uri": 
f"https://www.googleapis.com/compute/v1/projects/{PROJECT_ID}/zones/{ZONE}";,
           "metadata": {
               "enable-pepperdata": "false",
               "ha_flag": "no"
           },
           "shielded_instance_config": {
               "enable_secure_boot": True,
               "enable_vtpm": True,
               "enable_integrity_monitoring": True
           }
       }
   }
   
   # Create Dataproc cluster task
   create_cluster = DataprocCreateClusterOperator(
       task_id='create_dataproc_cluster',
       project_id=PROJECT_ID,
       cluster_name=CLUSTER_NAME,
       cluster_config=cluster_config,
       region=REGION,
       dag=dag
   )
   
   # Define task sequence
   create_cluster
   ```
   
   @eladkal I believe this issue can be closed for the moment.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to